Skip to content

test_critical_sections.c: unused function thread_critical_sections #120584

@sobolevn

Description

@sobolevn

Bug report

On systems where Py_CAN_START_THREADS is not defined (like wasm32-wasi 3.x), test_critical_sections_threads is not created:

#ifdef Py_CAN_START_THREADS
static PyObject *
test_critical_sections_threads(PyObject *self, PyObject *Py_UNUSED(args))
{
const Py_ssize_t NUM_THREADS = 4;

But, thread_critical_sections and struct test_data are always created. This leaves them unused in this case:

struct test_data {
PyObject *obj1;
PyObject *obj2;
PyObject *obj3;
Py_ssize_t countdown;
PyEvent done_event;
};
static void
thread_critical_sections(void *arg)
{
const Py_ssize_t NUM_ITERS = 200;

I propose to move #ifdef Py_CAN_START_THREADS upper to cover all the test utils as well.

Buildbot link with a warning: https://buildbot.python.org/all/#/builders/1046/builds/5439

../../Modules/_testinternalcapi/test_critical_sections.c:142:1: warning: unused function 'thread_critical_sections' [-Wunused-function]
1 warning generated.

Linked PRs

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions