Hello everybody! When I call fork() inside a daemon thread, the main thread in the child process has the "daemon" property set to True. This is very confusing, since the program keeps running while the only thread is a daemon. According to the docs, if all the threads are daemons the program should exit. Here is an example: import os import threading def child(): assert not threading.current_thread().daemon # This shouldn't fail def parent(): new_pid = os.fork() if new_pid == 0: child() else: os.waitpid(new_pid, 0) t = threading.Thread(target=parent) t.setDaemon(True) t.start() t.join() Is it a bug in the CPython implementation? Also let's assume the second example. I have another non-daemon thread in the child process and want to detect this situation. Does anybody know a way to find such fake daemon threads that are really main threads? Best regards, Elizaveta Shashkova. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20150625/666e8b16/attachment-0001.html>
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4