Qucs-S S-parameter Viewer & RF Synthesis Tools
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
greenlet::BrokenGreenlet Class Reference
Inheritance diagram for greenlet::BrokenGreenlet:
Inheritance graph
[legend]
Collaboration diagram for greenlet::BrokenGreenlet:
Collaboration graph
[legend]

Public Member Functions

 BrokenGreenlet (PyGreenlet *p, BorrowedGreenlet the_parent)
 
virtual switchstack_result_t g_switchstack (void)
 
virtual bool force_slp_switch_error () const noexcept
 
- Public Member Functions inherited from greenlet::UserGreenlet
 UserGreenlet (PyGreenlet *p, BorrowedGreenlet the_parent)
 
virtual refs::BorrowedMainGreenlet find_main_greenlet_in_lineage () const
 
virtual bool was_running_in_dead_thread () const noexcept
 
virtual ThreadStatethread_state () const noexcept
 
virtual OwnedObject g_switch ()
 
virtual const OwnedObject & run () const
 
virtual void run (const refs::BorrowedObject nrun)
 
virtual const OwnedGreenlet parent () const
 
virtual void parent (const refs::BorrowedObject new_parent)
 
virtual const refs::BorrowedMainGreenlet main_greenlet () const
 
virtual void murder_in_place ()
 
virtual bool belongs_to_thread (const ThreadState *state) const
 
virtual int tp_traverse (visitproc visit, void *arg)
 
virtual int tp_clear ()
 
virtual OwnedObject throw_GreenletExit_during_dealloc (const ThreadState &current_thread_state)
 
- Public Member Functions inherited from greenlet::Greenlet
 Greenlet (PyGreenlet *p)
 
const OwnedObject context () const
 
void may_switch_away ()
 
void context (refs::BorrowedObject new_context)
 
SwitchingArgsargs ()
 
intptr_t stack_saved () const noexcept
 
const char * stack_start () const noexcept
 
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
 
bool started () const
 
bool active () const
 
bool main () const
 
const PythonState::OwnedFrametop_frame ()
 
BorrowedGreenlet self () const noexcept
 

Static Public Member Functions

static void * operator new (size_t UNUSED(count))
 
static void operator delete (void *ptr)
 
- Static Public Member Functions inherited from greenlet::UserGreenlet
static void * operator new (size_t UNUSED(count))
 
static void operator delete (void *ptr)
 

Public Attributes

bool _force_switch_error = false
 
bool _force_slp_switch_error = false
 

Additional Inherited Members

- Protected Member Functions inherited from greenlet::UserGreenlet
virtual switchstack_result_t g_initialstub (void *mark)
 
- Protected Member Functions inherited from greenlet::Greenlet
 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
 
- Static Protected Member Functions inherited from greenlet::Greenlet
static void g_calltrace (const OwnedObject &tracefunc, const greenlet::refs::ImmortalEventName &event, const greenlet::refs::BorrowedGreenlet &origin, const BorrowedGreenlet &target)
 
- Protected Attributes inherited from greenlet::Greenlet
ExceptionState exception_state
 
SwitchingArgs switch_args
 
StackState stack_state
 
PythonState python_state
 

Member Function Documentation

◆ force_slp_switch_error()

bool greenlet::BrokenGreenlet::force_slp_switch_error ( ) const
virtualnoexcept

Reimplemented from greenlet::Greenlet.

◆ g_switchstack()

UserGreenlet::switchstack_result_t greenlet::BrokenGreenlet::g_switchstack ( void  )
virtual

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 from greenlet::Greenlet.


The documentation for this class was generated from the following files: