![]() |
Qucs-S S-parameter Viewer & RF Synthesis Tools
|


Classes | |
| class | GreenletStartedWhileInPython |
| struct | switchstack_result_t |
| class | TracingGuard |
Public Member Functions | |
| Greenlet (PyGreenlet *p) | |
| const OwnedObject | context () const |
| void | may_switch_away () |
| void | context (refs::BorrowedObject new_context) |
| SwitchingArgs & | args () |
| virtual const refs::BorrowedMainGreenlet | main_greenlet () const =0 |
| intptr_t | stack_saved () const noexcept |
| const char * | stack_start () const noexcept |
| virtual OwnedObject | throw_GreenletExit_during_dealloc (const ThreadState ¤t_thread_state) |
| virtual OwnedObject | g_switch ()=0 |
| virtual void | murder_in_place () |
| void | deactivate_and_free () |
| void | deallocing_greenlet_in_thread (const ThreadState *current_state) |
| void | expose_frames () |
| void | slp_restore_state () noexcept |
| int | slp_save_state (char *const stackref) noexcept |
| bool | is_currently_running_in_some_thread () const |
| virtual bool | belongs_to_thread (const ThreadState *state) const |
| bool | started () const |
| bool | active () const |
| bool | main () const |
| virtual refs::BorrowedMainGreenlet | find_main_greenlet_in_lineage () const =0 |
| virtual const OwnedGreenlet | parent () const =0 |
| virtual void | parent (const refs::BorrowedObject new_parent)=0 |
| const PythonState::OwnedFrame & | top_frame () |
| virtual const OwnedObject & | run () const =0 |
| virtual void | run (const refs::BorrowedObject nrun)=0 |
| virtual int | tp_traverse (visitproc visit, void *arg) |
| virtual int | tp_clear () |
| virtual ThreadState * | thread_state () const noexcept=0 |
| virtual bool | was_running_in_dead_thread () const noexcept=0 |
| BorrowedGreenlet | self () const noexcept |
| virtual bool | force_slp_switch_error () const noexcept |
Protected Member Functions | |
| Greenlet (PyGreenlet *p, const StackState &initial_state) | |
| void | release_args () |
| OwnedObject | on_switchstack_or_initialstub_failure (Greenlet *target, const switchstack_result_t &err, const bool target_was_me=false, const bool was_initial_stub=false) |
| virtual OwnedGreenlet | g_switchstack_success () noexcept |
| void | check_switch_allowed () const |
| virtual switchstack_result_t | g_switchstack (void) |
Static Protected Member Functions | |
| static void | g_calltrace (const OwnedObject &tracefunc, const greenlet::refs::ImmortalEventName &event, const greenlet::refs::BorrowedGreenlet &origin, const BorrowedGreenlet &target) |
Protected Attributes | |
| ExceptionState | exception_state |
| SwitchingArgs | switch_args |
| StackState | stack_state |
| PythonState | python_state |
Friends | |
| class | ThreadState |
| class | UserGreenlet |
| class | MainGreenlet |
|
inline |
Called when somebody notices we were running in a dead thread to allow cleaning up resources (because we can't raise GreenletExit into it anymore). This is very similar to murder_in_place(), except that it DOES NOT lose the main greenlet or thread state.
|
protectedvirtual |
Perform a stack switch into this greenlet.
This temporarily sets the global variable switching_thread_state to this greenlet; as soon as the call to slp_switch completes, this is reset to NULL. Consequently, this depends on the GIL.
TODO: Adopt the stackman model and pass slp_switch a callback function and context pointer; this eliminates the need for global variables altogether.
Because the stack switch happens in this function, this function can't use its own stack (local) variables, set before the switch, and then accessed after the switch.
Further, you con't even access g_thread_state_global before and after the switch from the global variable. Because it is thread local some compilers cache it in a register/on the stack, notably new versions of MSVC; this breaks with strange crashes sometime later, because writing to anything in g_thread_state_global after the switch is actually writing to random memory. For this reason, we call a non-inlined function to finish the operation. (XXX: The /GT MSVC compiler argument probably fixes that.)
It is very important that stack switch is 'atomic', i.e. no calls into other Python code allowed (except very few that are safe), because global variables are very fragile. (This should no longer be the case with thread-local variables.)
Reimplemented in greenlet::BrokenGreenlet.
|
virtual |
Force the greenlet to appear dead. Used when it's not possible to throw an exception into a greenlet anymore.
This losses access to the thread state and the main greenlet.
Reimplemented in greenlet::UserGreenlet.
|
protected |
CAUTION: This will allocate memory and may trigger garbage collection and arbitrary Python code.
|
virtual |
CAUTION: This will allocate memory and may trigger garbage collection and arbitrary Python code.
Reimplemented in greenlet::UserGreenlet.