redefined the API to avoid GC issues during the destruction of the AMAN and its children
This commit is contained in:
@@ -53,9 +53,18 @@ class ReceiverThread(Thread):
|
||||
|
||||
# @brief Receives and sends messages to EuroScope plugins
|
||||
class Euroscope:
|
||||
def __init__(self):
|
||||
self.context = None
|
||||
self.receiverSocket = None
|
||||
self.receiverThread = None
|
||||
self.notificationSocket = None
|
||||
|
||||
def __del__(self):
|
||||
self.release()
|
||||
|
||||
# @brief Initializes the ZMQ socket
|
||||
# @param[in] config The server configuration
|
||||
def __init__(self, configPath : str, config : Server, aman):
|
||||
def acquire(self, configPath : str, config : Server, aman):
|
||||
self.context = zmq.Context()
|
||||
|
||||
# find the key directories
|
||||
@@ -97,8 +106,16 @@ class Euroscope:
|
||||
self.notificationSocket.bind('tcp://' + config.Address + ':' + str(config.PortNotification))
|
||||
print('Publishing to tcp://' + config.Address + ':' + str(config.PortNotification))
|
||||
|
||||
def __del__(self):
|
||||
self.receiverThread.stopThread()
|
||||
self.receiverThread.join()
|
||||
self.receiverSocket.close()
|
||||
self.notificationSocket.close()
|
||||
def release(self):
|
||||
if None != self.receiverThread:
|
||||
self.receiverThread.stopThread()
|
||||
self.receiverThread.join()
|
||||
self.receiverThread = None
|
||||
|
||||
if None != self.receiverSocket:
|
||||
self.receiverSocket.close()
|
||||
self.receiverSocket = None
|
||||
|
||||
if None != self.notificationSocket:
|
||||
self.notificationSocket.close()
|
||||
self.notificationSocket = None
|
||||
|
||||
Reference in New Issue
Block a user