Is curses module thread-safe?

Grant Edwards invalid at invalid.invalid
Mon Nov 18 17:38:06 CET 2013

I'm working on a program that uses the curses module, and I'd like to
use multiple threads (using the threading module).  Is the curses module
in the standard library usable from multile threads?

I found a discussion from about 15 years ago that indicated it wasn't
at that time.  The example being discussed was that when one thread
calls a blocking getch(), the GIL isn't released and wall threads stop.
The suggesting work-around was to wrap the call to getch() with a
select() on sys.stdin.  Is that still an issue?

If two threads call addstr() "simultaneously" is it handled properly?

Or do all curses calls need to be made by a single thread?

Grant Edwards               grant.b.edwards        Yow! It don't mean a
                                  at               THING if you ain't got
                                that SWING!!

More information about the Python-list mailing list