SeriesPlugin 1.0: First public version
[enigma2-plugins.git] / seriesplugin / src / ThreadQueue.py
1 from threading import Lock
2
3
4 class ThreadQueue:
5         def __init__(self):
6                 self.__list = [ ]
7                 self.__lock = Lock()
8
9         def push(self, val):
10                 lock = self.__lock
11                 lock.acquire()
12                 self.__list.append(val)
13                 lock.release()
14
15         def pop(self):
16                 lock = self.__lock
17                 lock.acquire()
18                 if self.__list:
19                         ret = self.__list.pop()
20                 else:
21                         ret = (1, None, None)
22                 lock.release()
23                 return ret