Skip to content

Commit

Permalink
Add a lock around the block manager start
Browse files Browse the repository at this point in the history
Signed-off-by: Mic Bowman <[email protected]>
  • Loading branch information
cmickeyb committed Nov 1, 2024
1 parent 832f89f commit 099c2ac
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions python/pdo/common/block_store_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,20 @@

# XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
# XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
import threading
__block_manager_lock__ = threading.Lock()
__local_block_manager__ = None

def local_block_manager() :
global __local_block_manager__

__block_manager_lock__.acquire()
if __local_block_manager__ is None :
block_store_file = pconfig.shared_configuration(['StorageService','BlockStore'], "./blockstore.mdb")

__local_block_manager__ = BlockStoreManager(block_store_file, True)
__block_manager_lock__.release()

return __local_block_manager__

# XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Expand Down

0 comments on commit 099c2ac

Please sign in to comment.