Skip to content

Commit

Permalink
Go back to Py_CAN_START_THREADS
Browse files Browse the repository at this point in the history
  • Loading branch information
colesbury committed Nov 9, 2023
1 parent fe38ff9 commit 2ac2321
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
8 changes: 8 additions & 0 deletions Include/pyport.h
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,14 @@ extern "C" {
# define WITH_THREAD
#endif

/* Some WebAssembly platforms do not provide a working pthread implementation.
* Thread support is stubbed and any attempt to create a new thread fails.
*/
#if (!defined(HAVE_PTHREAD_STUBS) && \
(!defined(__EMSCRIPTEN__) || defined(__EMSCRIPTEN_PTHREADS__)))
# define Py_CAN_START_THREADS 1
#endif

#ifdef WITH_THREAD
# ifdef Py_BUILD_CORE
# ifdef HAVE_THREAD_LOCAL
Expand Down
4 changes: 2 additions & 2 deletions Modules/_testinternalcapi/test_critical_sections.c
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ thread_critical_sections(void *arg)
}
}

#ifndef HAVE_PTHREAD_STUBS
#ifdef Py_CAN_START_THREADS
static PyObject *
test_critical_sections_threads(PyObject *self, PyObject *Py_UNUSED(args))
{
Expand Down Expand Up @@ -201,7 +201,7 @@ static PyMethodDef test_methods[] = {
{"test_critical_sections", test_critical_sections, METH_NOARGS},
{"test_critical_sections_nest", test_critical_sections_nest, METH_NOARGS},
{"test_critical_sections_suspend", test_critical_sections_suspend, METH_NOARGS},
#ifndef HAVE_PTHREAD_STUBS
#ifdef Py_CAN_START_THREADS
{"test_critical_sections_threads", test_critical_sections_threads, METH_NOARGS},
#endif
{NULL, NULL} /* sentinel */
Expand Down

0 comments on commit 2ac2321

Please sign in to comment.