Skip to content

Instantly share code, notes, and snippets.

View joaoluizn's full-sized avatar
👨‍🚀
Coding and Listening to music

João Luiz joaoluizn

👨‍🚀
Coding and Listening to music
View GitHub Profile
@joaoluizn
joaoluizn / philosopher_deadlock.py
Created February 28, 2019 03:46
philosopher_deadlock.py
import thread
import time, random
import threading
fork = list()
# Fixed eating time
eating_time = random.randint(1, 4)
for i in range(5):
fork.append({'status': False, 'owner': None})
@joaoluizn
joaoluizn / philosopher.py
Created February 27, 2019 19:33
philosopher
import thread
import time, random
import threading
fork = list()
for i in range(5):
fork.append(threading.Semaphore(1))
def philosopher(f):
f = int(f)
@joaoluizn
joaoluizn / love.py
Created November 12, 2018 18:08
Infinite Love
while True:
print "Love"