class FobLogger(threading.Thread): def __init__(self, lock): threading.Thread.__init__(self) self.lock = lock self.fob = Fob() def run(self): while True: time.sleep(0.01) self.lock.acquire() main.coordinate = self.fob.getcord() # I hope this will work!, but now I dont have time deal with it; self.lock.release()
class Foblogger(threading.Thread): def __init__(self, t_name): threading.Thread.__init__(self, name=t_name) self.fob = Fob() def run(self): global COORD global FLAG global data_fob t0 = time.time() tp = time.time() while FLAG: ti = time.time() if ti - tp >= (0.0075): tp = time.time() MY_LOCK.acquire() COORD = self.fob.getcord() MY_LOCK.release() COORD.append(tp - t0) x = np.array([COORD]) data_fob = np.concatenate((data_fob, x), axis=0) print 'fob logger thread exiting...'