gevent.thread
– Implementation of the standard thread
module that spawns greenlets¶Note
This module is a helper for gevent.monkey
and is not
intended to be used directly. For spawning greenlets in your
applications, prefer higher level constructs like
gevent.Greenlet
class or gevent.spawn()
.
error
¶alias of builtins.RuntimeError
allocate_lock
¶alias of gevent.thread.LockType
LockType
(*args, **kwargs)[source]¶Bases: gevent._semaphore.BoundedSemaphore
acquire
(blocking=True, timeout=None) → bool[source]¶Acquire the semaphore.
Caution
If this semaphore was initialized with a size of 0, this method will block forever (unless a timeout is given or blocking is set to false).
Parameters: |
|
---|---|
Returns: | A boolean indicating whether the semaphore was acquired.
If |
allocate
()¶allocate_lock() -> lock object (allocate() is an obsolete synonym)
Create a new lock object. See help(type(threading.Lock())) for information about locks.
exit_thread
()¶exit() (exit_thread() is an obsolete synonym)
This is synonymous to ``raise SystemExit’’. It will cause the current thread to exit silently unless the exception is caught.
interrupt_main
()¶Raise a KeyboardInterrupt in the main thread. A subthread can use this function to interrupt the main thread.
start_new
()¶start_new_thread(function, args[, kwargs]) (start_new() is an obsolete synonym)
Start a new thread and return its identifier. The thread will call the function with positional arguments from the tuple args and keyword arguments taken from the optional dictionary kwargs. The thread exits when the function returns; the return value is ignored. The thread will also exit when the function raises an unhandled exception; a stack trace will be printed unless the exception is SystemExit.
get_native_id
() → integer¶Return a non-negative integer identifying the thread as reported by the OS (kernel). This may be used to uniquely identify a particular thread within a system.
Next page: gevent.threading
– Implementation of the standard threading
using greenlets