Last active
October 9, 2020 21:06
-
-
Save AsafFisher/aef425f59e90368a1ffcf199461546ea to your computer and use it in GitHub Desktop.
cool
This file contains 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
macro_rules! concurrent { | |
( | |
[ $($pass_rc:ident),* ];$($x:expr);*; | |
) => { | |
{ | |
{ | |
$( | |
let $pass_rc = Arc::new($pass_rc); | |
let $pass_rc = &$pass_rc.clone(); | |
)* | |
std::thread::spawn(move || { | |
$( | |
$x; | |
)* | |
}) | |
} | |
} | |
} | |
} | |
// Start the broadcasting, pass the Arc of multicast_addr and b_stopper | |
let handle = concurrent! {[self.multicast_addr, self.b_stopper]; | |
broadcast(send_socket, multicast_addr, | |
b_stopper).unwrap(); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment