lets say I have a program which initializes a list with random values. The application then spawns a bunch of threads and each thread keeps popping items out of this shared list. My question is , is this operation thread safe :
try:
while global_list.pop():
...do something ..
except:
print ("list is empty")
Will it ever be the case that data is lost due to race condition between threads
EDIT: I have referred to link Are lists thread-safe , however there is manipulation on list data in the referenced question, I am simply talking about popping items out of list which is modifying the list and not the data within. In my code snippet do something does not signify operations on list data, it is simply some processing unrelated to list data.