Skip to content

Instantly share code, notes, and snippets.

@joeyism
Last active January 2, 2020 16:18
Show Gist options
  • Save joeyism/38c469ff114be90fa00d2fbbbb064b68 to your computer and use it in GitHub Desktop.
Save joeyism/38c469ff114be90fa00d2fbbbb064b68 to your computer and use it in GitHub Desktop.
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