My problem is how to share a variable or a buffer between more than one class e.g. writing into a single buffer from multiple classes knowing that some classes are running in a threaded environment example
class my1(object):
def __init__(self):
self.buffer=[0]*5
self.size=0
def insert(self,data):
self.data=data
self.buffer[self.size]=self.data
self.size+=1
class my2(my1):
def __init__(self):
self.insert('data1')
class my3(my1):
def __init__(self):
self.insert('data2')
The desired result would be the buffer containing both data1 and data2 to be processed yet the buffer within class my1 is defined inside the (init) section and cannot be shared any suggestions? Thanks alot