MCPcopy Create free account
hub / github.com/apache/thrift / wake_up

Method wake_up

lib/py/src/server/TNonblockingServer.py:275–286  ·  view source on GitHub ↗

Wake up main thread. The server usually waits in select call in we should terminate one. The simplest way is using socketpair. Select always wait to read from the first socket of socketpair. In this case, we can just write anything to the second socket from

(self)

Source from the content-addressed store, hash-verified

273 self.prepared = True
274
275 def wake_up(self):
276 """Wake up main thread.
277
278 The server usually waits in select call in we should terminate one.
279 The simplest way is using socketpair.
280
281 Select always wait to read from the first socket of socketpair.
282
283 In this case, we can just write anything to the second socket from
284 socketpair.
285 """
286 self._write.send(b'1')
287
288 def stop(self):
289 """Stop the server.

Callers 2

stopMethod · 0.95
readyMethod · 0.80

Calls 1

sendMethod · 0.80

Tested by

no test coverage detected