Added function to notify ScriptLanguage when a thread is created/freed, allows scripts to allocate a stack there via TLS

This commit is contained in:
Juan Linietsky
2016-06-25 10:40:33 -03:00
parent c931ed976b
commit 8dac3bf3b1
7 changed files with 49 additions and 5 deletions

View File

@ -29,6 +29,7 @@
#include "thread_jandroid.h"
#include "os/memory.h"
#include "script_language.h"
Thread::ID ThreadAndroid::get_ID() const {
@ -44,8 +45,10 @@ void *ThreadAndroid::thread_callback(void *userdata) {
ThreadAndroid *t=reinterpret_cast<ThreadAndroid*>(userdata);
setup_thread();
ScriptServer::thread_enter(); //scripts may need to attach a stack
t->id=(ID)pthread_self();
t->callback(t->user);
ScriptServer::thread_exit();
return NULL;
}