The Backend API is deprecated as of March 13, 2014. Although Google will
continue to support the Backend API in accordance with our
terms of service
, it is strongly recommended that all new applications
use the
Modules API
instead.
The
google.appengine.api.background_thread
module defines
functions and classes for working with
background threads
,
threads which can "outlive" the request that spawned them.
Function
- background_thread.start_new_background_thread ( target , args , kwargs =None)
- target
- Callable object to run in new thread
- args
- List of positional arguments passed to target
- kwargs
- Dictionary of keyword arguments passed to target
Creates and starts a background thread. Returns the thread's id.
Arguments
BackgroundThread class
A
BackgroundThread
is like a
threading.Thread
but can "outlive" the request that spawns it.
Constructor
- class background_thread.BackgroundThread ( group =None, target =None, name =None, args =None, kwargs =None, verbose =None)
-
This constructor should always be called with keyword arguments.
Arguments
- group
-
Should be
None
; reserved for a future extension when a PythonThreadGroup
class is implemented. - target
- Callable object that will run in the background thread.
- name
- Thread name.
- args
- List of positional arguments passed to target
- kwargs
- Dictionary of keyword arguments passed to target
Instance Methods
- start ()
- Start the thread. Call this at most once per thread.
- run ()
- Method representing the thread's activity; a subclass can override this to do something else instead of calling target .
- join ( timeout =None)
- Wait until the thread terminates. The optional floating point timeout argument specifies a maxium number of seconds to wait.
-
is_alive
()
isAlive () - Returns a Boolean indicating whether the thread is alive.
-
is_daemon
()
isDaemon () - Returns a Boolean indicating whether the thread is a daemon thread.