You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
use pthread_atfork to make the runtime fork safe #9568
other approach would be to just have the runtime not start more than one thread, ever. This would be much saner actually, since user code that grabs locks is almost impossible to modify to make it fork safe. #9373
Obviously single-threaded everything isn't what is wanted in the general case where you do want to exploit multiple cores, but it would be nice to have the option for code that wants to use tradition daemon style fork-ing.
@brson: I'm not sure if it would be feasible, but in theory we can register handlers with pthread_atfork to re-initialize a fresh runtime in a new process. I don't think it's very important, so it might be too difficult to be worth the trouble.
The old system for handling daemons was for the end of the first child to signal that initialization was done, but this has been superseded by socket activation in systemd, upstart and launchd.
I think the option of using #![no_std] with libcore is fine. Rust does need to provide an I/O and concurrency library at a lower level than the full blown runtime, but I think that's inevitable.
Activity
glycerine commentedon Sep 27, 2013
this would be excellent
glycerine commentedon Sep 27, 2013
other approach would be to just have the runtime not start more than one thread, ever. This would be much saner actually, since user code that grabs locks is almost impossible to modify to make it fork safe. #9373
Obviously single-threaded everything isn't what is wanted in the general case where you do want to exploit multiple cores, but it would be nice to have the option for code that wants to use tradition daemon style fork-ing.
brson commentedon Sep 27, 2013
what would the runtime do to be fork-safe? this seems very difficult.
thestinger commentedon Sep 28, 2013
@brson: I'm not sure if it would be feasible, but in theory we can register handlers with
pthread_atforkto re-initialize a fresh runtime in a new process. I don't think it's very important, so it might be too difficult to be worth the trouble.The old system for handling daemons was for the end of the first child to signal that initialization was done, but this has been superseded by socket activation in
systemd,upstartandlaunchd.thestinger commentedon Aug 19, 2014
I think the option of using
#![no_std]with libcore is fine. Rust does need to provide an I/O and concurrency library at a lower level than the full blown runtime, but I think that's inevitable.Auto merge of rust-lang#9568 - matthiaskrgr:tools_util_bump, r=flip1995
Merge rust-lang#9567 rust-lang#9568