MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / put

Method put

tools/python-3.11.9-amd64/Lib/asyncio/queues.py:110–135  ·  view source on GitHub ↗

Put an item into the queue. Put an item into the queue. If the queue is full, wait until a free slot is available before adding item.

(self, item)

Source from the content-addressed store, hash-verified

108 return self.qsize() >= self._maxsize
109
110 async def put(self, item):
111 """Put an item into the queue.
112
113 Put an item into the queue. If the queue is full, wait until a free
114 slot is available before adding item.
115 """
116 while self.full():
117 putter = self._get_loop().create_future()
118 self._putters.append(putter)
119 try:
120 await putter
121 except:
122 putter.cancel() # Just in case putter is not done yet.
123 try:
124 # Clean self._putters from canceled putters.
125 self._putters.remove(putter)
126 except ValueError:
127 # The putter could be removed from self._putters by a
128 # previous get_nowait call.
129 pass
130 if not self.full() and not putter.cancelled():
131 # We were woken up by get_nowait(), but can't take
132 # the call. Wake up the next in line.
133 self._wakeup_next(self._putters)
134 raise
135 return self.put_nowait(item)
136
137 def put_nowait(self, item):
138 """Put an item into the queue without blocking.

Callers 13

refactorMethod · 0.45
refactor_fileMethod · 0.45
_python_exitFunction · 0.45
_workerFunction · 0.45
submitMethod · 0.45
weakref_cbMethod · 0.45
shutdownMethod · 0.45
_sendback_resultFunction · 0.45
_process_workerFunction · 0.45
submitMethod · 0.45
mainFunction · 0.45

Calls 9

fullMethod · 0.95
_wakeup_nextMethod · 0.95
put_nowaitMethod · 0.95
_get_loopMethod · 0.80
create_futureMethod · 0.45
appendMethod · 0.45
cancelMethod · 0.45
removeMethod · 0.45
cancelledMethod · 0.45

Tested by

no test coverage detected