0% completed
from multiprocessing import Process
def task():
print("Task executed")
# Code to create and start a new process
from threading import Thread, Lock
balance = 0
lock = Lock()
def deposit():
global balance
for _ in range(100000):
lock.acquire()
balance += 1
lock.release()
t1 = Thread(target=deposit)
t2 = Thread(target=deposit)
t1.start()
t2.start()
t1.join()
t2.join()
print(balance)
async def async_generator():
for i in range(5):
yield i
await asyncio.sleep(1)
.....
.....
.....