Calling os.waitpid() From Secondary Thread Under Linux 2.2.12-20?
Jonathan Giddy
jon at dgs.monash.edu.au
Wed Apr 12 02:50:52 EDT 2000
More information about the Python-list mailing list
Wed Apr 12 02:50:52 EDT 2000
- Previous message (by thread): How to know what re.sub took?
- Next message (by thread): Calling os.waitpid() From Secondary Thread Under Linux 2.2.12-20?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Randy Wiser declared: > >I've written a small python program that spawns one child process from >its main thread, and then creates a second thread. The sole purpose >of the second thread (at this point) is to call os.waitpid(processID, >0) to wait for the child that the main thread created. This works >fine under Solaris when I call os.waitpid() from the second thread. > >But, under Linux 2.2.12-20 I get the following OSError exception: > >[Errno 10] No child processes I recently had this reported as a problem in code I developed on a Sun, which was then run on Linux. I believe it is due to Linux threads being separate processes, hence the second thread is not the spawned process's parent and cannot wait for it. (Presumably, if pthread_join() works, then waitpid() should be able to work too, since they must be the same function on Linux). Anyway, my (non-)solution was to redesign my code to wait from the same thread as the fork(). If you can't move the waitpid() into the main thread, maybe you can move the fork() into the second thread. Jon.
- Previous message (by thread): How to know what re.sub took?
- Next message (by thread): Calling os.waitpid() From Secondary Thread Under Linux 2.2.12-20?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list