Last active
January 2, 2020 16:18
-
-
Save joeyism/38c469ff114be90fa00d2fbbbb064b68 to your computer and use it in GitHub Desktop.
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
import torch.multiprocessing as mp | |
QUEUE_SIZE = mp.Value('i', 0) | |
def _decrease_queue(): | |
with QUEUE_SIZE.get_lock(): | |
QUEUE_SIZE.value -= 1 | |
def _increase_queue(): | |
with QUEUE_SIZE.get_lock(): | |
QUEUE_SIZE.value += 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment