from direct.stdpy.thread import LockType, allocate_lock, exit, get_ident, interrupt_main, stack_size, start_new_thread


This module reimplements Python’s native thread module using Panda threading constructs. It’s designed as a drop-in replacement for the thread module for code that works with Panda; it is necessary because in some compilation models, Panda’s threading constructs are incompatible with the OS-provided threads used by Python’s thread module.

Inheritance diagram

class LockType[source]

Bases: object

Implements a mutex lock. Instead of directly subclassing PandaModules.Mutex, we reimplement the lock here, to allow us to provide the described Python lock semantics. In particular, this allows a different thread to release the lock than the one that acquired it.

__init__(self)[source]
acquire(self, waitflag=1, timeout=-1)[source]
locked(self)[source]
release(self)[source]
allocate_lock()[source]
considerYield()

C++ Interface: consider_yield()

/**
• Possibly suspends the current thread for the rest of the current epoch, if

• it has run for enough this epoch. This is especially important for the

• simple thread implementation, which relies on cooperative yields like this.

*/

consider_yield()

C++ Interface: consider_yield()

/**
• Possibly suspends the current thread for the rest of the current epoch, if

• it has run for enough this epoch. This is especially important for the

• simple thread implementation, which relies on cooperative yields like this.

*/

exit()[source]
forceYield()

C++ Interface: force_yield()

/**
• Suspends the current thread for the rest of the current epoch.

*/

force_yield()

C++ Interface: force_yield()

/**
• Suspends the current thread for the rest of the current epoch.

*/

get_ident()[source]
interrupt_main()[source]
stack_size(size=0)[source]
start_new_thread(function, args, kwargs={}, name=None)[source]