MCPcopy Index your code
hub / github.com/USArmyResearchLab/Dshell / QueueOutputWrapper

Class QueueOutputWrapper

dshell/output/output.py:251–272  ·  view source on GitHub ↗

Wraps an instance of any other Output-like object to make its write function more thread safe.

Source from the content-addressed store, hash-verified

249
250
251class QueueOutputWrapper(object):
252 """
253 Wraps an instance of any other Output-like object to make its
254 write function more thread safe.
255 """
256
257 def __init__(self, oobject, oqueue):
258 self.__oobject = oobject
259 self.__owrite = oobject.write
260 self.queue = oqueue
261 self.id = str(self.__oobject)
262
263 def true_write(self, *args, **kwargs):
264 "Calls the wrapped class's write function. Called from decode.py."
265 self.__owrite(*args, **kwargs)
266
267 def write(self, *args, **kwargs):
268 """
269 Adds a message to the queue indicating that this wrapper is ready to
270 run its write function
271 """
272 self.queue.put((self.id, args, kwargs))
273
274
275###############################################################################

Callers 1

mainFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected