diff runtime.c @ 87:345d4c0e3dd3

Thread safety exceptions are now properly raised by all relevant pymonkey functions.
author Atul Varma <varmaa@toolness.com>
date Sun, 09 Aug 2009 16:17:25 -0700
parents 2b5696b91b01
children
line wrap: on
line diff
--- a/runtime.c	Sun Aug 09 15:46:40 2009 -0700
+++ b/runtime.c	Sun Aug 09 16:17:25 2009 -0700
@@ -46,6 +46,7 @@
 
   self = (PYM_JSRuntimeObject *) type->tp_alloc(type, 0);
   if (self != NULL) {
+    self->thread = PyThread_get_thread_ident();
     self->rt = NULL;
     self->cx = NULL;
     self->objects.ops = NULL;
@@ -106,6 +107,7 @@
 static PyObject *
 PYM_newContext(PYM_JSRuntimeObject *self, PyObject *args)
 {
+  PYM_SANITY_CHECK(self);
   JSContext *cx = JS_NewContext(self->rt, 8192);
   if (cx == NULL) {
     PyErr_SetString(PYM_error, "JS_NewContext() failed");