import threading

x = 0

def increment():
    global x
    x +=1

def fun(lock):
    lock.acquire()
    increment()
    print("value of x in fun {}".format(x))
    lock.release()
def fun2(lock):
    lock.acquire()
    increment()
    print("value of x in fun2 {}".format(x))
    lock.release()

if __name__ == "__main__":

    lock = threading.Lock()

    t1 = threading.Thread(target = fun, args=(lock,))
    t2 = threading.Thread(target = fun, args=(lock,))

    t1.start()
    t2.start()

    t1.join()
    t2.join()

cf62cbea7efcfacb824d9d7d36b92eef56f8d781
<mask token>


def increment():
    global x
    x += 1


def fun(lock):
    lock.acquire()
    increment()
    print('value of x in fun {}'.format(x))
    lock.release()


def fun2(lock):
    lock.acquire()
    increment()
    print('value of x in fun2 {}'.format(x))
    lock.release()


<mask token>

<mask token>


def increment():
    global x
    x += 1


def fun(lock):
    lock.acquire()
    increment()
    print('value of x in fun {}'.format(x))
    lock.release()


def fun2(lock):
    lock.acquire()
    increment()
    print('value of x in fun2 {}'.format(x))
    lock.release()


if __name__ == '__main__':
    lock = threading.Lock()
    t1 = threading.Thread(target=fun, args=(lock,))
    t2 = threading.Thread(target=fun, args=(lock,))
    t1.start()
    t2.start()
    t1.join()
    t2.join()

<mask token>
x = 0


def increment():
    global x
    x += 1


def fun(lock):
    lock.acquire()
    increment()
    print('value of x in fun {}'.format(x))
    lock.release()


def fun2(lock):
    lock.acquire()
    increment()
    print('value of x in fun2 {}'.format(x))
    lock.release()


if __name__ == '__main__':
    lock = threading.Lock()
    t1 = threading.Thread(target=fun, args=(lock,))
    t2 = threading.Thread(target=fun, args=(lock,))
    t1.start()
    t2.start()
    t1.join()
    t2.join()

import threading
x = 0


def increment():
    global x
    x += 1


def fun(lock):
    lock.acquire()
    increment()
    print('value of x in fun {}'.format(x))
    lock.release()


def fun2(lock):
    lock.acquire()
    increment()
    print('value of x in fun2 {}'.format(x))
    lock.release()


if __name__ == '__main__':
    lock = threading.Lock()
    t1 = threading.Thread(target=fun, args=(lock,))
    t2 = threading.Thread(target=fun, args=(lock,))
    t1.start()
    t2.start()
    t1.join()
    t2.join()

import threading

x = 0

def increment():
    global x
    x +=1

def fun(lock):
    lock.acquire()
    increment()
    print("value of x in fun {}".format(x))
    lock.release()
def fun2(lock):
    lock.acquire()
    increment()
    print("value of x in fun2 {}".format(x))
    lock.release()

if __name__ == "__main__":

    lock = threading.Lock()

    t1 = threading.Thread(target = fun, args=(lock,))
    t2 = threading.Thread(target = fun, args=(lock,))

    t1.start()
    t2.start()

    t1.join()
    t2.join()
