gevent.thread – Implementation of the standard thread module that spawns greenlets


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().


alias of RuntimeError


allocate_lock() -> lock object (allocate() is an obsolete synonym)

Create a new lock object. See help(type(threading.Lock())) for information about locks.


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.


Raise a KeyboardInterrupt in the main thread. A subthread can use this function to interrupt the main thread.


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.

Next page: gevent.threading – Implementation of the standard threading using greenlets