Is curses thread-safe?
"Martin v. Löwis"
martin at v.loewis.de
Sat Apr 12 04:51:25 EDT 2003
Brian Alexander wrote:
> Is the curses module thread-safe? Can I do this:
>
> class windowThread(threadClass):
> def __init__(self):
> threadClass.__init__()
> self.thisWindow = curses.newwin()
> ...
>
> ... and expect every thread created to behave well during calls the the
> curses I/O routines?
Yes, curses is protected by the global interpreter lock: No two calls
into curses are allowed simultaneously.
Of course, if you have interleaving calls from two threads, you may
notice strange effects (e.g. if both change the cursor position, the
second call takes precedence)
Regards,
Martin
More information about the Python-list
mailing list