Mercurial > pymonkey
comparison utils.h @ 66:b49180c39d0a
Pymonkey now handles the GIL properly so that Python code can run while JS code does.
author | Atul Varma <varmaa@toolness.com> |
---|---|
date | Sun, 26 Jul 2009 15:06:19 -0700 |
parents | bc4263c6ae82 |
children | 3baa418b7ba8 |
comparison
equal
deleted
inserted
replaced
65:f89a582c1276 | 66:b49180c39d0a |
---|---|
41 | 41 |
42 #include <jsapi.h> | 42 #include <jsapi.h> |
43 #include <jsdhash.h> | 43 #include <jsdhash.h> |
44 #include <Python/Python.h> | 44 #include <Python/Python.h> |
45 | 45 |
46 class PYM_PyAutoEnsureGIL { | |
47 public: | |
48 PYM_PyAutoEnsureGIL() { | |
49 state = PyGILState_Ensure(); | |
50 } | |
51 | |
52 ~PYM_PyAutoEnsureGIL() { | |
53 PyGILState_Release(state); | |
54 } | |
55 | |
56 protected: | |
57 PyGILState_STATE state; | |
58 }; | |
59 | |
46 typedef struct { | 60 typedef struct { |
47 JSDHashEntryStub base; | 61 JSDHashEntryStub base; |
48 void *value; | 62 void *value; |
49 } PYM_HashEntry; | 63 } PYM_HashEntry; |
50 | 64 |