def f(lock, q): with lock: pid = getpid() ts = time.time() msg = 'process: {} - timestamp: {}'.format(pid, ts) q.put(msg) time.sleep(1)
def f(sem, q): with sem: pid = getpid() ts = time.time() msg = 'process: {} - timestamp: {}'.format(pid, ts) q.put(msg) time.sleep(3)
def f(barrier, q): barrier.wait() pid = getpid() ts = time.time() msg = 'process: {} - timestamp: {}'.format(pid, ts) q.put(msg)
def f(q): print("I'm process", getpid()) q.put([42, None, 'hello']) time.sleep(5)