1 //===-- SBHostOS.cpp --------------------------------------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #include "lldb/API/SBHostOS.h"
11 #include "lldb/API/SBError.h"
12 #include "lldb/Host/FileSpec.h"
13 #include "lldb/Core/Log.h"
14 #include "lldb/Host/Host.h"
15 
16 using namespace lldb;
17 using namespace lldb_private;
18 
19 
20 
21 SBFileSpec
22 SBHostOS::GetProgramFileSpec ()
23 {
24     SBFileSpec sb_filespec;
25     sb_filespec.SetFileSpec (Host::GetProgramFileSpec ());
26     return sb_filespec;
27 }
28 
29 lldb::thread_t
30 SBHostOS::ThreadCreate
31 (
32     const char *name,
33     void *(*thread_function)(void *),
34     void *thread_arg,
35     SBError *error_ptr
36 )
37 {
38     LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
39 
40     if (log)
41         log->Printf ("SBHostOS::ThreadCreate (name=\"%s\", thread_function=%p, thread_arg=%p, error_ptr=%p)", name,
42                      thread_function, thread_arg, error_ptr);
43 
44     // FIXME: You should log the return value?
45 
46     return Host::ThreadCreate (name, thread_function, thread_arg, error_ptr ? error_ptr->get() : NULL);
47 }
48 
49 void
50 SBHostOS::ThreadCreated (const char *name)
51 {
52     Host::ThreadCreated (name);
53 }
54 
55 bool
56 SBHostOS::ThreadCancel (lldb::thread_t thread, SBError *error_ptr)
57 {
58     return Host::ThreadCancel (thread, error_ptr ? error_ptr->get() : NULL);
59 }
60 
61 bool
62 SBHostOS::ThreadDetach (lldb::thread_t thread, SBError *error_ptr)
63 {
64     return Host::ThreadDetach (thread, error_ptr ? error_ptr->get() : NULL);
65 }
66 
67 bool
68 SBHostOS::ThreadJoin (lldb::thread_t thread, void **result, SBError *error_ptr)
69 {
70     return Host::ThreadJoin (thread, result, error_ptr ? error_ptr->get() : NULL);
71 }
72 
73 
74