Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 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/Core/FileSpec.h" |
Caroline Tice | 7826c88 | 2010-10-26 03:11:13 +0000 | [diff] [blame] | 13 | #include "lldb/Core/Log.h" |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 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 | { |
Caroline Tice | 7826c88 | 2010-10-26 03:11:13 +0000 | [diff] [blame] | 38 | Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); |
| 39 | |
| 40 | if (log) |
Greg Clayton | 49ce682 | 2010-10-31 03:01:06 +0000 | [diff] [blame] | 41 | log->Printf ("SBHostOS::ThreadCreate (name=\"%s\", thread_function=%p, thread_arg=%p, error_ptr=%p)", name, |
Caroline Tice | 61ba7ec | 2010-10-26 23:49:36 +0000 | [diff] [blame] | 42 | thread_function, thread_arg, error_ptr); |
Caroline Tice | 7826c88 | 2010-10-26 03:11:13 +0000 | [diff] [blame] | 43 | |
| 44 | // CAROLINE: FIXME: You need to log a return value? |
| 45 | |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 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 | |