Message143379
| Author |
arigo |
| Recipients |
arigo, asvetlov, barry, daniel.urban, nadeem.vawda, ncoghlan, pitrou |
| Date |
2011年09月02日.05:33:00 |
| SpamBayes Score |
6.0811817e-05 |
| Marked as misclassified |
No |
| Message-id |
<1314941581.69.0.473849794886.issue12850@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
Antoine: we could take two lines from the current implementation of these hook from stm/transactionmodule.c, and move them to the interpreter core. CPython would end up with containing the core logic for transactions. A possible API would look like that:
/* stops all threads different from 'tstate' at their next
bytecode, at which point the given callback is invoked */
_PyEval_SetThreadStopper(PyThreadState *tstate, void (*callback)(void));
Such a function can also be tested in CPython, e.g. with ctypes. Still maybe a different name would be better, like _PyEval_InternalThreadStopper(). Or, if that's still a callback too much:
/* stops all threads different from 'tstate' at their next bytecode,
at which point they wait for the 'lock' to be available */
_PyEval_SetThreadStopper(PyThreadState *tstate, PyThread_lock_type lock); |
|