diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/unix/thread_posix.cpp | 7 | ||||
-rw-r--r-- | drivers/windows/thread_windows.cpp | 9 | ||||
-rw-r--r-- | drivers/windows/thread_windows.h | 1 |
3 files changed, 16 insertions, 1 deletions
diff --git a/drivers/unix/thread_posix.cpp b/drivers/unix/thread_posix.cpp index 6ace64a923..c71e09685b 100644 --- a/drivers/unix/thread_posix.cpp +++ b/drivers/unix/thread_posix.cpp @@ -27,6 +27,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #include "thread_posix.h" +#include "script_language.h" #if defined(UNIX_ENABLED) || defined(PTHREAD_ENABLED) @@ -50,7 +51,13 @@ void *ThreadPosix::thread_callback(void *userdata) { ThreadPosix *t=reinterpret_cast<ThreadPosix*>(userdata); t->id=(ID)pthread_self(); + + ScriptServer::thread_enter(); //scripts may need to attach a stack + t->callback(t->user); + + ScriptServer::thread_exit(); + return NULL; } diff --git a/drivers/windows/thread_windows.cpp b/drivers/windows/thread_windows.cpp index d5e489aab4..884575e81e 100644 --- a/drivers/windows/thread_windows.cpp +++ b/drivers/windows/thread_windows.cpp @@ -32,6 +32,7 @@ #include "os/memory.h" + Thread::ID ThreadWindows::get_ID() const { return id; @@ -45,8 +46,14 @@ Thread* ThreadWindows::create_thread_windows() { DWORD ThreadWindows::thread_callback( LPVOID userdata ) { ThreadWindows *t=reinterpret_cast<ThreadWindows*>(userdata); - t->callback(t->user); + + ScriptServer::thread_enter(); //scripts may need to attach a stack + t->id=(ID)GetCurrentThreadId(); // must implement + t->callback(t->user); + + ScriptServer::thread_exit(); + return 0; } diff --git a/drivers/windows/thread_windows.h b/drivers/windows/thread_windows.h index b051bfe370..1c90504dde 100644 --- a/drivers/windows/thread_windows.h +++ b/drivers/windows/thread_windows.h @@ -36,6 +36,7 @@ #ifdef WINDOWS_ENABLED #include "os/thread.h" +#include "script_language.h" #include <windows.h> class ThreadWindows : public Thread { |