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) |
| 41 | log->Printf ("SBHostOS::ThreadCreate (%s, %p, %p, error_ptr)", name, thread_function, thread_arg); |
| 42 | |
| 43 | // CAROLINE: FIXME: You need to log a return value? |
| 44 | |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 45 | return Host::ThreadCreate (name, thread_function, thread_arg, error_ptr ? error_ptr->get() : NULL); |
| 46 | } |
| 47 | |
| 48 | void |
| 49 | SBHostOS::ThreadCreated (const char *name) |
| 50 | { |
| 51 | Host::ThreadCreated (name); |
| 52 | } |
| 53 | |
| 54 | bool |
| 55 | SBHostOS::ThreadCancel (lldb::thread_t thread, SBError *error_ptr) |
| 56 | { |
| 57 | return Host::ThreadCancel (thread, error_ptr ? error_ptr->get() : NULL); |
| 58 | } |
| 59 | |
| 60 | bool |
| 61 | SBHostOS::ThreadDetach (lldb::thread_t thread, SBError *error_ptr) |
| 62 | { |
| 63 | return Host::ThreadDetach (thread, error_ptr ? error_ptr->get() : NULL); |
| 64 | } |
| 65 | |
| 66 | bool |
| 67 | SBHostOS::ThreadJoin (lldb::thread_t thread, void **result, SBError *error_ptr) |
| 68 | { |
| 69 | return Host::ThreadJoin (thread, result, error_ptr ? error_ptr->get() : NULL); |
| 70 | } |
| 71 | |
| 72 | |