summaryrefslogtreecommitdiffstats
path: root/drivers/unix
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2016-06-25 10:40:33 -0300
committerJuan Linietsky <reduzio@gmail.com>2016-06-25 10:41:23 -0300
commit8dac3bf3b10406d05c4d520e81082e490e3b76ff (patch)
treefa7cd3a9a8f5758855969bf8488b6cd141eb1bbc /drivers/unix
parentc931ed976b5952d7f0972f4c8c4efe279db456ac (diff)
downloadredot-engine-8dac3bf3b10406d05c4d520e81082e490e3b76ff.tar.gz
Added function to notify ScriptLanguage when a thread is created/freed, allows scripts to allocate a stack there via TLS
Diffstat (limited to 'drivers/unix')
-rw-r--r--drivers/unix/thread_posix.cpp7
1 files changed, 7 insertions, 0 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;
}