Opened 12 years ago
Closed 12 years ago
#941 closed enhancement (fixed)
Add option to process-fork to allow creating a subprocess with only the current thread
Reported by: | sjamaan | Owned by: | |
---|---|---|---|
Priority: | minor | Milestone: | someday |
Component: | core libraries | Version: | 4.8.x |
Keywords: | posix, processes, fork | Cc: | |
Estimated difficulty: |
Description
It would be useful to have the option to call process-fork without having all the threads running in the new process (like in SCSH's fork procedure).
This will make it easy to fork off "worker" processes in multithreaded server processes without causing threads to write multiple copies of response data to all connected clients.
After discussion with Felix we came to the conclusion that this needs a hook in the scheduler to "promote" arbitrary threads to become the primordial thread, and to blow away all non-primordial threads. Including file descriptors and the I/O wait list, as well as the pending threads list etc.
When this is implemented, people can safely use the scsh-process egg's macros in spiffy, for example.
This was implemented by 47b5be71353305425a419831ff2a5682a5c39df1 (thanks, Felix!)