Skip to content

Commit

Permalink
ResourcePool : modify some methods to thread-safe (need to test)
Browse files Browse the repository at this point in the history
  • Loading branch information
exch-bms2 committed Jan 21, 2019
1 parent dbbab12 commit daf1085
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/bms/player/beatoraja/ResourcePool.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public boolean exists(K key) {
* @param key リソースのキー
* @return リソース。読めなかった場合はnullを返す
*/
public V get(K key) {
public synchronized V get(K key) {
ResourceCacheElement<V> ie = image.get(key);
if(ie == null) {
V resource = load(key);
Expand All @@ -64,7 +64,7 @@ public V get(K key) {
/**
* 世代数を進め、最大世代数を経過したリソースを開放する
*/
public void disposeOld() {
public synchronized void disposeOld() {
removes.clear();
for(ObjectMap.Entry<K, ResourceCacheElement<V>> entry : image) {
ResourceCacheElement<V> ie = entry.value;
Expand Down

0 comments on commit daf1085

Please sign in to comment.