diff options
| author | Matthew Collins <[email protected]> | 2018-05-05 17:07:07 +0100 |
|---|---|---|
| committer | Matthew Collins <[email protected]> | 2018-05-05 17:07:07 +0100 |
| commit | f3accef78c9de43727d7eae93f190952e486a7c8 (patch) | |
| tree | 677a7d0cffe960fa159871485a759f230fcff44b /src/matchmaking.rs | |
| parent | Rework how the sys crate is generated (diff) | |
| download | archived-steamworks-rs-f3accef78c9de43727d7eae93f190952e486a7c8.tar.xz archived-steamworks-rs-f3accef78c9de43727d7eae93f190952e486a7c8.zip | |
Only allow run_callbacks to be run on a single thread at any time
Diffstat (limited to 'src/matchmaking.rs')
| -rw-r--r-- | src/matchmaking.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/matchmaking.rs b/src/matchmaking.rs index 177cb8e..f219381 100644 --- a/src/matchmaking.rs +++ b/src/matchmaking.rs @@ -54,7 +54,7 @@ impl <Manager> Matchmaking<Manager> { /// * `LobbyEnter` /// * `LobbyCreated` pub fn create_lobby<F>(&self, ty: LobbyType, max_members: u32, mut cb: F) - where F: FnMut(Result<LobbyId, SteamError>) + 'static + Send + Sync + where F: FnMut(Result<LobbyId, SteamError>) + 'static + Send { assert!(max_members <= 250); // Steam API limits unsafe { @@ -81,7 +81,7 @@ impl <Manager> Matchmaking<Manager> { /// Tries to join the lobby with the given ID pub fn join_lobby<F>(&self, lobby: LobbyId, mut cb: F) - where F: FnMut(Result<LobbyId, ()>) + 'static + Send + Sync + where F: FnMut(Result<LobbyId, ()>) + 'static + Send { unsafe { let api_call = sys::SteamAPI_ISteamMatchmaking_JoinLobby(self.mm, lobby.0); @@ -109,7 +109,7 @@ impl <Manager> Matchmaking<Manager> { #[test] fn test_lobby() { - let client = Client::init().unwrap(); + let (client, single) = Client::init().unwrap(); let mm = client.matchmaking(); mm.request_lobby_list(|v| { @@ -120,7 +120,7 @@ fn test_lobby() { }); for _ in 0 .. 100 { - client.run_callbacks(); + single.run_callbacks(); ::std::thread::sleep(::std::time::Duration::from_millis(100)); } }
\ No newline at end of file |