diff options
| author | Flavio Percoco <flaper87@gmail.com> | 2014-12-24 17:40:40 +0100 |
|---|---|---|
| committer | Flavio Percoco <flaper87@gmail.com> | 2014-12-26 17:26:33 +0100 |
| commit | bb315f25f84c93b69d99d41b2c68185639c30e83 (patch) | |
| tree | 7d5ad491eeadcbb8a707126cebdd285a57ec7dc9 /src/libstd/sys/common | |
| parent | 52072dec0f6838ae251259a8f0574776c2028a1b (diff) | |
| download | rust-bb315f25f84c93b69d99d41b2c68185639c30e83.tar.gz rust-bb315f25f84c93b69d99d41b2c68185639c30e83.zip | |
Implement RaceBox for StdinReader
Diffstat (limited to 'src/libstd/sys/common')
| -rw-r--r-- | src/libstd/sys/common/helper_thread.rs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/libstd/sys/common/helper_thread.rs b/src/libstd/sys/common/helper_thread.rs index b0137bdad06..a629f035b07 100644 --- a/src/libstd/sys/common/helper_thread.rs +++ b/src/libstd/sys/common/helper_thread.rs @@ -63,6 +63,11 @@ unsafe impl<M:Send> Send for Helper<M> { } unsafe impl<M:Send> Sync for Helper<M> { } +struct RaceBox(helper_signal::signal); + +unsafe impl Send for RaceBox {} +unsafe impl Sync for RaceBox {} + impl<M: Send> Helper<M> { /// Lazily boots a helper thread, becoming a no-op if the helper has already /// been spawned. @@ -85,9 +90,11 @@ impl<M: Send> Helper<M> { let (receive, send) = helper_signal::new(); *self.signal.get() = send as uint; + let receive = RaceBox(receive); + let t = f(); Thread::spawn(move |:| { - helper(receive, rx, t); + helper(receive.0, rx, t); let _g = self.lock.lock(); *self.shutdown.get() = true; self.cond.notify_one() |
