| 1 |
from pypy.module._hpy_universal.apiset import API |
| 2 |
from pypy.module._hpy_universal.llapi import cts |
| 3 |
|
| 4 |
@API.func("void HPy_ReenterPythonExecution(HPyContext *ctx, HPyThreadState state)", |
| 5 |
gil="acquire", |
| 6 |
) |
| 7 |
def HPy_ReenterPythonExecution(space, handles, ctx, state): |
| 8 |
"""Acquire the global interpreter lock (if it has been created) and set the |
| 9 |
thread state to tstate, which must not be NULL. If the lock has been |
| 10 |
created, the current thread must not have acquired it, otherwise deadlock |
| 11 |
ensues.""" |
| 12 |
|
| 13 |
pass |
| 14 |
|
| 15 |
@API.func("HPyThreadState HPy_LeavePythonExecution(HPyContext *ctx)", |
| 16 |
error_value=cts.cast("HPyThreadState", -1), |
| 17 |
gil="release", |
| 18 |
) |
| 19 |
def HPy_LeavePythonExecution(space, handles, ctx): |
| 20 |
"""Release the global interpreter lock (if it has been created) |
| 21 |
and reset the thread state to NULL, returning the |
| 22 |
previous thread state. If the lock has been created, |
| 23 |
the current thread must have acquired it.""" |
| 24 |
|
| 25 |
return cts.cast("HPyThreadState", 0) |