The Virtual Machine Host runs receptors and interfaces between the outside world and the cptr world.
More...
|
file | vmhost.c |
| virtual machine host receptor implementation
|
|
file | vmhost.h |
| vmhost implementation header file
|
|
|
#define | SELF_RECEPTOR_ADDR -1 |
|
#define | MAX_ACTIVE_RECEPTORS 1000 |
|
#define | MAX_RECEPTORS 1000 |
|
|
VMHost * | __v_init (Receptor *r, SemTable *sem) |
|
VMHost * | _v_new () |
| Creates a new virtual machine host. More...
|
|
void | _v_free (VMHost *r) |
|
Xaddr | _v_load_receptor_package (VMHost *v, T *p) |
|
Xaddr | _v_install_r (VMHost *v, Xaddr package, T *bindings, char *label) |
|
Xaddr | _v_new_receptor (VMHost *v, Receptor *parent, Symbol s, Receptor *r) |
|
void | _v_activate (VMHost *v, Xaddr x) |
|
void | _v_send (VMHost *v, ReceptorAddress from, ReceptorAddress to, Aspect aspect, Symbol carrier, T *contents) |
|
void | _v_send_signals (VMHost *v, T *signals) |
|
void | _v_deliver_signals (VMHost *v, Receptor *sender) |
|
void * | __v_process (void *arg) |
|
void | _v_instantiate_builtins (VMHost *v) |
|
void | _v_start_vmhost (VMHost *v) |
|
void | _v_start_thread (thread *t, void *(*start_routine)(void *), void *arg) |
|
void | _v_join_thread (thread *t) |
|
The Virtual Machine Host runs receptors and interfaces between the outside world and the cptr world.
void* __v_process |
( |
void * |
arg | ) |
|
this is the VMhost main monitoring and execution thread
Definition at line 273 of file vmhost.c.
Activate a receptor
- Parameters
-
Definition at line 172 of file vmhost.c.
- Todo:
- this should probably be implemented in a scape but for now
scaffolding function for signal delivery
Definition at line 235 of file vmhost.c.
Destroys a vmhost freeing all memory it uses.
- Parameters
-
Definition at line 71 of file vmhost.c.
install a receptor into vmhost, creating a symbol for it
- Parameters
-
[in] | v | VMHost in which to install the receptor |
[in] | package | xaddr of package to install |
[in] | bindings | completed manifest which specifies how the receptor will be installed |
[in] | label | label to be used for the semantic name for this receptor |
- Returns
- Xaddr of the instance
Examples (from test suite):
- Todo:
- expand the manifest to allow optional binding, etc, using semtrex to do the matching instead of assuming positional matching
Definition at line 109 of file vmhost.c.
void _v_instantiate_builtins |
( |
VMHost * |
v | ) |
|
create all the built in receptors that exist in all VMhosts
Definition at line 324 of file vmhost.c.
Add a receptor package into the local compository to make it available for installation and binding
- Parameters
-
[in] | v | VMHost in which to install the receptor |
[in] | p | receptor package |
- Returns
- Xaddr of the receptor package in the compository
- Todo:
- validate signature and checksums??
Examples (from test suite):
Definition at line 90 of file vmhost.c.
Creates a new virtual machine host.
allocates all the memory needed in the heap
- Returns
- pointer to a newly allocated VMHost
Examples (from test suite):
spec_is_equal(sem->contexts,_NUM_DEFAULT_CONTEXTS);
spec_is_equal(
_t_children(
_t_child(sem->stores[0].definitions,SEM_TYPE_SYMBOL)),NUM_SYS_SYMBOLS-1);
spec_is_equal(
_t_children(
_t_child(sem->stores[0].definitions,SEM_TYPE_STRUCTURE)),NUM_SYS_STRUCTURES-1);
spec_is_str_equal(t2s(v->
r->
root),
"(RECEPTOR_INSTANCE (INSTANCE_OF:SYS_RECEPTOR) (CONTEXT_NUM:0) (PARENT_CONTEXT_NUM:-1) (RECEPTOR_STATE (FLUX (DEFAULT_ASPECT (EXPECTATIONS) (SIGNALS))) (PENDING_SIGNALS) (PENDING_RESPONSES) (CONVERSATIONS) (RECEPTOR_ELAPSED_TIME:0)))");
spec_is_sem_equal(v->installed_receptors->key_source,RECEPTOR_IDENTIFIER);
spec_is_sem_equal(v->installed_receptors->data_source,RECEPTOR_SURFACE);
Definition at line 41 of file vmhost.c.
scaffolding for send a signal from ouside the VMhost
Examples (from test suite):
Definition at line 194 of file vmhost.c.
void _v_send_signals |
( |
VMHost * |
v, |
|
|
T * |
signals |
|
) |
| |
walk through the list of signals and send them
Definition at line 203 of file vmhost.c.