#include "parts.h"
#include "pycore_critical_section.h"
#ifdef Py_GIL_DISABLED
#define assert_nogil …
#define assert_gil …
#else
#define assert_gil …
#define assert_nogil(x) …
#endif
static PyObject *
test_critical_sections(PyObject *self, PyObject *Py_UNUSED(args))
{ … }
static void
lock_unlock_object(PyObject *obj, int recurse_depth)
{ … }
static void
lock_unlock_two_objects(PyObject *a, PyObject *b, int recurse_depth)
{ … }
static PyObject *
test_critical_sections_nest(PyObject *self, PyObject *Py_UNUSED(args))
{ … }
static PyObject *
test_critical_sections_suspend(PyObject *self, PyObject *Py_UNUSED(args))
{ … }
#ifdef Py_CAN_START_THREADS
struct test_data { … };
static void
thread_critical_sections(void *arg)
{ … }
static PyObject *
test_critical_sections_threads(PyObject *self, PyObject *Py_UNUSED(args))
{ … }
static void
pysleep(int ms)
{ … }
struct test_data_gc { … };
static void
thread_gc(void *arg)
{ … }
static PyObject *
test_critical_sections_gc(PyObject *self, PyObject *Py_UNUSED(args))
{ … }
#endif
static PyMethodDef test_methods[] = …;
int
_PyTestInternalCapi_Init_CriticalSection(PyObject *mod)
{ … }