Threads sleeping all instead of just one.

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

    #1

    Threads sleeping all instead of just one.

    Hello. Could you advise me about this, please?
    I write a multi-thread program using the 'threading' module. Moreover, I use C++ extension. Two threads work inside this C++ extension in such way that one thread waits for the other to do something. However it seems that ALL python is stopped by the first thread stopping. And not that the one thread stops and the other runs to wake the former up, as it is intended in the C++ extension.
    Is it the problem, that I am not using Python's synchronization means, but C++'s ?
    Thank you very much. V.
  • Diez B. Roggisch

    #2
    Re: Threads sleeping all instead of just one.

    Vaclav Havlik schrieb:[color=blue]
    > Hello. Could you advise me about this, please?
    > I write a multi-thread program using the 'threading' module. Moreover, I use C++ extension. Two threads work inside this C++ extension in such way that one thread waits for the other to do something. However it seems that ALL python is stopped by the first thread stopping. And not that the one thread stops and the other runs to wake the former up, as it is intended in the C++ extension.
    > Is it the problem, that I am not using Python's synchronization means, but C++'s ?
    > Thank you very much. V.[/color]

    I guess the problem lies in not releasing the GIL
    (GlobalInterpre terLock) inside your C++-Extension. That makes the
    interpreter lock.

    Google for that, you'll find plenty of stuff on the GIL.

    Regards,

    DIez

    Comment

    Working...