5 examples of 'python wait' in Python

Every line of 'python wait' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
47def (self):
48 return self.程序.wait()
37def wait(*args):
38 input(colors.BLUE + fmt(args) + colors.END)
274def group_wait(timeout):
275 try:
276 os.waitpid(self.pid, 0)
277 except OSError, e:
278 pass # If wait has already been called on this pid, bad things happen
279 return self.returncode
318def wait(self, timeout = None):
319 self.__lock.acquire()
320 try:
321 if timeout is None:
322 while not self.__flag:
323 self.__cvar.wait()
324 else:
325 clock = core.TrueClock.getGlobalPtr()
326 expires = clock.getShortTime() + timeout
327 while not self.__flag:
328 wait = expires - clock.getShortTime()
329 if wait < 0:
330 return
332 self.__cvar.wait(wait)
334 finally:
335 self.__lock.release()
108def wait(self, timeout=None):
109 """
110 Block until the internal flag is true.
112 If the internal flag is true on entry, return immediately. Otherwise,
113 block until another thread (greenlet) calls :meth:`set` to set the flag to true,
114 or until the optional timeout occurs.
116 When the *timeout* argument is present and not ``None``, it should be a
117 floating point number specifying a timeout for the operation in seconds
118 (or fractions thereof).
120 :return: This method returns true if and only if the internal flag has been set to
121 true, either before the wait call or after the wait starts, so it will
122 always return ``True`` except if a timeout is given and the operation
123 times out.
125 .. versionchanged:: 1.1
126 The return value represents the flag during the elapsed wait, not
127 just after it elapses. This solves a race condition if one greenlet
128 sets and then clears the flag without switching, while other greenlets
129 are waiting. When the waiters wake up, this will return True; previously,
130 they would still wake up, but the return value would be False. This is most
131 noticeable when the *timeout* is present.
132 """
133 return self._wait(timeout)

Related snippets