Skip to content

Instantly share code, notes, and snippets.

@stestagg
Last active December 21, 2015 13:09
Show Gist options
  • Save stestagg/6311039 to your computer and use it in GitHub Desktop.
Save stestagg/6311039 to your computer and use it in GitHub Desktop.
cdef extern from "unistd.h":
cdef void sleep(int time)
def lock(time):
print "starting to block"
sleep(10)
print "stop blocking"
import pyximport; pyximport.install()
import time
import gil
import threading
class Test(threading.Thread):
def run(self):
num = 0
while True:
print num
num += 1
def main():
tt = Test()
tt.daemon = True
tt.start()
time.sleep(0.1)
gil.lock(4)
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment