Skip to content

Instantly share code, notes, and snippets.

@schipiga
Created December 7, 2019 04:07
Show Gist options
  • Save schipiga/c01456f9c370853c13a87a3a709f7ea7 to your computer and use it in GitHub Desktop.
Save schipiga/c01456f9c370853c13a87a3a709f7ea7 to your computer and use it in GitHub Desktop.
import os
import time
from pebble import ProcessPool
def task():
pid = os.fork()
if pid == 0: # child process
time.sleep(1)
os._exit(0)
pool = ProcessPool(max_workers=1)
with pool:
pool.schedule(task)
time.sleep(15)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment