Qucs-S S-parameter Viewer & RF Synthesis Tools
Loading...
Searching...
No Matches
Namespaces | Classes | Typedefs | Functions
greenlet Namespace Reference

Namespaces

namespace  tests
 

Classes

class  AttributeError
 
class  BrokenGreenlet
 
class  ExceptionState
 
class  Greenlet
 
class  GreenletGlobals
 
class  LockInitError
 
class  MainGreenlet
 
class  PyErrOccurred
 
class  PyFatalError
 
struct  PythonAllocator
 
class  PythonState
 
class  PythonStateContext
 
class  StackState
 
class  SwitchingArgs
 
class  ThreadState
 
struct  ThreadState_DestroyNoGIL
 
class  ThreadStateCreator
 
class  TypeError
 
class  UserGreenlet
 
class  ValueError
 

Typedefs

typedef std::vector< ThreadState * > cleanup_queue_t
 
typedef std::mutex Mutex
 
typedef std::lock_guard< Mutex > LockGuard
 
typedef void(* ThreadStateDestructor) (ThreadState *const)
 

Functions

OwnedObject & operator<<= (OwnedObject &lhs, greenlet::SwitchingArgs &rhs) noexcept
 
template<typename T >
void operator<< (const PyThreadState *const tstate, T &exc)
 

Detailed Description

The root of the greenlet package.

Defines various utility functions to help greenlet integrate well with threads. This used to be needed when we supported Python 2.7 on Windows, which used a very old compiler. We wrote an alternative implementation using Python APIs and POSIX or Windows APIs, but that's no longer needed. So this file is a shadow of its former self — but may be needed in the future.

Implementation of greenlet::UserGreenlet.

Format with: clang-format -i –style=file src/greenlet/greenlet.c

Fix missing braces with: clang-tidy src/greenlet/greenlet.c -fix -checks="readability-braces-around-statements"

Function Documentation

◆ operator<<=()

OwnedObject & greenlet::operator<<= ( OwnedObject &  lhs,
greenlet::SwitchingArgs rhs 
)
noexcept

CAUTION: May invoke arbitrary Python code.

Figure out what the result of greenlet.switch(arg, kwargs) should be and transfers ownership of it to the left-hand-side.

If switch() was just passed an arg tuple, then we'll just return that. If only keyword arguments were passed, then we'll pass the keyword argument dict. Otherwise, we'll create a tuple of (args, kwargs) and return both.

CAUTION: This may allocate a new tuple object, which may cause the Python garbage collector to run, which in turn may run arbitrary Python code that switches.