Skip to content
This repository has been archived by the owner on Jul 1, 2024. It is now read-only.

Commit

Permalink
Set shards in Arc
Browse files Browse the repository at this point in the history
  • Loading branch information
DimitriTimoz committed Dec 24, 2023
1 parent 6540cf2 commit ab8c09b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions minecraft-server/src/world/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ pub struct WorldMap {
/// The shards are locked independently.
/// This allows high concurrency.
shard_count: usize,
shards: Vec<RwLock<HashMap<ChunkColumnPosition, ChunkColumn>>>,
shards: Vec<Arc<RwLock<HashMap<ChunkColumnPosition, ChunkColumn>>>>,
}

#[derive(Clone)]
Expand Down Expand Up @@ -227,7 +227,7 @@ impl WorldMap {
pub fn new(shard_count: usize) -> WorldMap {
let mut shards = Vec::new();
for _ in 0..shard_count {
shards.push(RwLock::new(HashMap::new()));
shards.push(Arc::new(RwLock::new(HashMap::new())));
}
WorldMap { shard_count, shards }
}
Expand Down

0 comments on commit ab8c09b

Please sign in to comment.