Help please, turning off threads

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jive

    #1

    Help please, turning off threads

    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.


  • Nick Coghlan

    #2
    Re: Help please, turning off threads

    Jive wrote:[color=blue]
    > 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[/color]

    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.

    Comment

    • Jive

      #3
      Re: Help please, turning off threads


      "Nick Coghlan" <ncoghlan@email .com> wrote in message
      news:41a7041c$0 $25785$5a62ac22 @per-qv1-newsreader-01.iinet.net.au ...[color=blue]
      > Jive wrote:[color=green]
      > > 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[/color]
      >
      > I believe the configure script removes threadmodule.c from the build[/color]
      process[color=blue]
      > when threads are not enabled. I haven't actually checked, though.
      >
      > Building threadmodule.c when threads aren't being used suggests a mistake[/color]
      in the[color=blue]
      > build process - but is it the inclusion of threadmodule.c which is[/color]
      incorrect, or[color=blue]
      > is it the lack of the WITH_THREADS definition?
      >[/color]

      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.



      Comment

      Working...