Help please, turning off threads

J

Jive

I've ported Python to a realtime operating system and embedded it in an
application that controls machinery. Python will be used to expose an API
to end users. It seems prudent to disable threads.

I undefined WITH_THREAD. Now I run into this in threadmodule.c:

#error "Error! The rest of Python is not compiled with thread support."
#error "Rerun configure, adding a --with-threads option."
#error "Then run `make clean' followed by `make'."

Problem is, I've never run configure, and probably could not if I wanted to.
I used the NT distribution and hacked it into submission. All the Python
source code I'm using is now checked into a source control system. I doubt
that "configure" could handle that. I don't use "make" either.

Can someone tell me how to "configure" for no threads by hand? Does it
suffice just to remove the offending file threadmodule.c? If that is the
case, why the error message rather than just

#ifndef WITH_THREAD
#else
// the thread stuff
#endif

I removed the file from the project just to see what would happen. The
project built without reporting an error, and the program seems to run
Python okay.
 
N

Nick Coghlan

Jive said:
Can someone tell me how to "configure" for no threads by hand? Does it
suffice just to remove the offending file threadmodule.c? If that is the
case, why the error message rather than just

I believe the configure script removes threadmodule.c from the build process
when threads are not enabled. I haven't actually checked, though.

Building threadmodule.c when threads aren't being used suggests a mistake in the
build process - but is it the inclusion of threadmodule.c which is incorrect, or
is it the lack of the WITH_THREADS definition?

Regards,
Nick.
 
J

Jive

Nick Coghlan said:
I believe the configure script removes threadmodule.c from the build process
when threads are not enabled. I haven't actually checked, though.

Building threadmodule.c when threads aren't being used suggests a mistake in the
build process - but is it the inclusion of threadmodule.c which is incorrect, or
is it the lack of the WITH_THREADS definition?

In this case it's neither. I just changed the #ifdef in threadmodule.c so
the file is effectively empty when WITH_THREADS is not defined. That seems
to work okay. No problems so far.

I don't didn't want to remove the file from the project. I might want to
compile with threads enabled later. If and when that happens, I won't have
to remember to include the threadmodule.c file. I'll just define the
WITH_THREADS and all will be kookletikoo.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,212
Messages
2,571,101
Members
47,695
Latest member
KayleneBee

Latest Threads

Top