diff options
| author | Michael Bebenita <[email protected]> | 2010-08-24 21:06:56 -0700 |
|---|---|---|
| committer | Michael Bebenita <[email protected]> | 2010-08-24 21:07:14 -0700 |
| commit | 64ff82ecf98ceb4725f0f51c73e23d1efc2160bc (patch) | |
| tree | 6a6ae7452066716947c4d262eb72041a6a11cb95 /src/test/run-fail | |
| parent | Comment on env var required for std.dbg to do any logging. (diff) | |
| download | rust-64ff82ecf98ceb4725f0f51c73e23d1efc2160bc.tar.xz rust-64ff82ecf98ceb4725f0f51c73e23d1efc2160bc.zip | |
Implemented an lock free queue based on this paper http://www.cs.rochester.edu/~scott/papers/1996_PODC_queues.pdf, the "lock free queue" we had before wasn't lock free at all.
Diffstat (limited to 'src/test/run-fail')
| -rw-r--r-- | src/test/run-fail/task-comm-14.rs | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/test/run-fail/task-comm-14.rs b/src/test/run-fail/task-comm-14.rs new file mode 100644 index 00000000..f5fa27ac --- /dev/null +++ b/src/test/run-fail/task-comm-14.rs @@ -0,0 +1,26 @@ +io fn main() { + let port[int] po = port(); + + // Spawn 10 tasks each sending us back one int. + let int i = 10; + while (i > 0) { + log i; + spawn "child" child(i, chan(po)); + i = i - 1; + } + + i = 10; + let int value = 0; + while (i > 0) { + log i; + value <- po; + i = i - 1; + } + + log "main thread exiting"; +} + +io fn child(int x, chan[int] ch) { + log x; + ch <| x; +} |