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

@@ -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;
}