Created
          May 24, 2013 12:02 
        
      - 
      
- 
        Save MaikKlein/5643027 to your computer and use it in GitHub Desktop. 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | use core::comm::{stream, Chan,PortSet}; | |
| fn main() { | |
| let p : PortSet<~str> = PortSet::new(); | |
| for 3.times { | |
| let(receive,send) : (Port<~str>, Chan<~str>) = stream(); | |
| p.add(receive); | |
| } | |
| let chan = p.chan(); | |
| do spawn { | |
| for 3.times { | |
| let mut s = ~""; | |
| s += p.recv(); | |
| println(s); | |
| } | |
| } | |
| chan.send(~"Test1"); | |
| chan.send(~"Test2"); | |
| chan.send(~"Test3"); | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment