MCPcopy Create free account
hub / github.com/NVIDIA/DALI / close

Method close

dali/python/nvidia/dali/_multiproc/shared_queue.py:118–131  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

116 self.shm.close_handle()
117
118 def close(self):
119 if self.is_closed:
120 return
121 with self.lock:
122 self._read_meta()
123 self.is_closed = True
124 if not self.meta.is_closed:
125 self.meta.is_closed = 1
126 self._write_meta()
127 # Notify only one waiting worker about closing the queue, the woken up worker
128 # will notify the next one. Avoid notify_all at this point, due to possible
129 # deadlock if one of the notified workers exited abruptly when waiting
130 # on cv_not_empty without proper releasing of the underlying semaphore.
131 self.cv_not_empty.notify()
132
133 def put(self, msgs: List[MSG_CLASS]) -> Optional[int]:
134 assert len(msgs), "Cannot write an empty list of messages"

Callers 3

setup_queue_and_workerFunction · 0.95
open_shmMethod · 0.45
closeMethod · 0.45

Calls 2

_read_metaMethod · 0.95
_write_metaMethod · 0.95

Tested by 1

setup_queue_and_workerFunction · 0.76