diff options
author | Philip Chimento <philip.chimento@gmail.com> | 2017-05-02 21:02:47 -0700 |
---|---|---|
committer | Philip Chimento <philip.chimento@gmail.com> | 2017-05-05 23:21:28 -0700 |
commit | 9aa41162dca48036abb51370fa2d2b63e7397447 (patch) | |
tree | dda8b836c3e09b1216c87903ba54bc5f8d98838c | |
parent | 2337884f9ba4e6ebaf324082fa2738b81c2c8582 (diff) | |
download | gjs-9aa41162dca48036abb51370fa2d2b63e7397447.tar.gz |
context: Use GThread to determine owner thread
The thread facilities are going away in SpiderMonkey 52, so we use GThread
to determine a context's owner thread in order to be able to check it
later. (g_thread_self() will still work if GLib didn't create the thread.)
https://bugzilla.gnome.org/show_bug.cgi?id=781429
-rw-r--r-- | gjs/context.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/gjs/context.cpp b/gjs/context.cpp index 1d77a398..2b506c2c 100644 --- a/gjs/context.cpp +++ b/gjs/context.cpp @@ -69,7 +69,7 @@ struct _GjsContext { JSRuntime *runtime; JSContext *context; JS::Heap<JSObject*> global; - intptr_t owner_thread; + GThread *owner_thread; char *program_name; @@ -487,7 +487,7 @@ gjs_context_constructed(GObject *object) js_context->runtime = gjs_runtime_ref(); JS_AbortIfWrongThread(js_context->runtime); - js_context->owner_thread = JS_GetCurrentThread(); + js_context->owner_thread = g_thread_self(); js_context->context = JS_NewContext(js_context->runtime, 8192 /* stack chunk size */); if (js_context->context == NULL) @@ -666,7 +666,7 @@ context_reset_exit(GjsContext *js_context) bool _gjs_context_get_is_owner_thread(GjsContext *js_context) { - return js_context->owner_thread == JS_GetCurrentThread(); + return js_context->owner_thread == g_thread_self(); } /** |