Commit 79a0d84e authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

Back to swig malloc for the message queue

parent 0549280e
......@@ -27,7 +27,7 @@ import logging
import argparse
import time
from functools import partial
from ctypes import CDLL, c_void_p
from ctypes import CDLL
log = logging.getLogger(__name__)
terminal_formatter = logging.Formatter(
......@@ -60,7 +60,7 @@ except ImportError:
datamodel = None
try:
from PythonController import(OpenMsgQueueForReading,
from PythonController import(OpenMsgQueueForReading, new_byte_SWIG_PTR,
GetMsgQueueBufferSize, DV, RetrieveMessageFromQueue)
python_controller = True
except ImportError:
......@@ -93,9 +93,6 @@ class MsgQ_Poller(QThread):
self.Qname = "{uid}_{fvname}_PI_queue".format(uid=str(os.geteuid()),
fvname=datamodel.FVname)
self.log.info('msQ name= ' + self.Qname)
self.libc = CDLL('libc.so.6')
self.malloc = self.libc.malloc
self.malloc.restype = c_void_p
def run(self):
self.log.debug('Starting msgQ polling thread')
......@@ -111,7 +108,7 @@ class MsgQ_Poller(QThread):
"Retrying...".format(Qname=self.Qname))
time.sleep(1)
bufferSize = GetMsgQueueBufferSize(self._msgQueue)
pDataFromMQ = self.malloc(bufferSize) # DV.new_byte_SWIG_PTR(bufferSize)
pDataFromMQ = new_byte_SWIG_PTR(bufferSize)
while not self._bDie:
messageReceivedType = RetrieveMessageFromQueue(
self._msgQueue, bufferSize, pDataFromMQ)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment