Concrete Python  git-339c971
Classes | Public Member Functions | Static Public Member Functions
Context Class Reference

#include <concrete/context.hpp>

+ Inheritance diagram for Context:
+ Collaboration diagram for Context:

List of all members.

Classes

struct  Data

Public Member Functions

 Context (EventLoop &loop)
 Context (EventLoop &loop, void *data, size_t size)
bool is_active () const throw ()
EventLoop & event_loop () throw ()
Arena & arena () throw ()
ResourceManager & resource_manager () throw ()
Data * data ()
const Data * nonthrowing_data () throw ()
const Pointer & none_pointer () const throw ()
Object load_builtin_name (const Object &name)
Object import_builtin_module (const Object &name)
void add_execution (const Execution &execution)
Portable< Execution > & execution () throw ()
void suspend_until (const EventTrigger &trigger)
bool executable () throw ()
bool execute ()

Static Public Member Functions

static Context & Active () throw ()

Detailed Description

Python interpreter state. Instances are isolated from one another, so one process can have multiple interpreters running--either in separate threads or interleaved in common threads. A thread must not make nested calls to different Context instances because the active instance is passed around via thread-local data (without support for nesting).


Constructor & Destructor Documentation

Context ( EventLoop &  loop) [explicit]

Create a new state.

Parameters:
loopis owned by the caller and must live over the lifetime of the created Context instance
Context ( EventLoop &  loop,
void *  data,
size_t  size 
)

Load state from a snapshot.

Parameters:
loopis owned by the caller and must live over the lifetime of the created Context instance
datawill be copied
sizeof the data in bytes

Member Function Documentation

Context & Active ( ) throw () [static]

Get the active instance of the current thread.

void add_execution ( const Execution &  execution)

Add a new executor. It will be scheduled at some point.

Parameters:
executionreference is stolen
Arena& arena ( ) throw ()

Access the persistent memory.

Direct access to internal object vector.

Returns:
borrowed short-term reference
EventLoop& event_loop ( ) throw ()

Access the I/O event interface.

bool executable ( ) throw ()

Are there any unfinished executors (and the interpreter is in normal state)?

bool execute ( )

Schedule an executor.

Returns:
true if there is more to execute immediately; otherwise the caller should wait for an I/O event first
Portable< Execution > & execution ( ) throw ()

Get the active executor of this interpreter.

Returns:
borrowed short-term reference
Object import_builtin_module ( const Object &  name)

Look up an internal module.

bool is_active ( ) const throw ()

Is this the active instance of the current thread?

Object load_builtin_name ( const Object &  name)

Look up an internal function or constant.

const Pointer& none_pointer ( ) const throw ()

Uncounted reference to the NoneObject instance.

Returns:
borrowed short-term NoneObject reference
const Context::Data * nonthrowing_data ( ) throw ()

Direct access to internal object vector.

Returns:
borrowed short-term reference or NULL

Access the transient resources.

void suspend_until ( const EventTrigger &  trigger)

Suspend the active executor until an I/O event occurs.

Parameters:
triggerspecifies the event which causes execution to resume