ceptr
 All Data Structures Files Functions Variables Typedefs Macros Modules Pages
vmhost.h
Go to the documentation of this file.
1 
13 #ifndef _CEPTR_VMHOST_H
14 #define _CEPTR_VMHOST_H
15 
16 #include "receptor.h"
17 
18 #define SELF_RECEPTOR_ADDR -1
19 
20 typedef struct thread {
21  int state;
22  pthread_t pthread;
23 } thread;
24 
25 typedef struct ActiveReceptor {
26  Xaddr x;
27  Receptor *r;
29 
30 typedef struct ReceptorRoute {
31  Receptor *r;
32  SemanticID s;
34 
35 #define MAX_ACTIVE_RECEPTORS 1000
36 #define MAX_RECEPTORS 1000
37 
40 struct VMHost {
41  ReceptorRoute routing_table[MAX_RECEPTORS];
42  int receptor_count;
45  ActiveReceptor active_receptors[MAX_ACTIVE_RECEPTORS];
46  int active_receptor_count;
47  Scape *installed_receptors;
48  thread vm_thread;
49  thread clock_thread;
50  int process_state;
51  char *dir;
52 };
53 typedef struct VMHost VMHost;
54 
55 /****************** create and destroy virtual machine */
56 VMHost *__v_init(Receptor *r,SemTable *sem);
57 VMHost * _v_new();
58 void _v_free(VMHost *r);
59 
61 Xaddr _v_install_r(VMHost *v,Xaddr package,T *bindings,char *label);
62 Xaddr _v_new_receptor(VMHost *v,Receptor *parent,Symbol s, Receptor *r);
63 void _v_activate(VMHost *v, Xaddr x);
64 void _v_send(VMHost *v,ReceptorAddress from,ReceptorAddress to,Aspect aspect,Symbol carrier,T *contents);
65 void _v_send_signals(VMHost *v,T *signals);
66 
67 void _v_deliver_signals(VMHost *v, Receptor *sender);
68 
69 void * __v_process(void *arg);
70 
72 void _v_start_vmhost(VMHost *v);
73 
74 /****************** thread handling */
75 void _v_start_thread(thread *t,void *(*start_routine)(void*), void *arg);
76 void _v_join_thread(thread *t);
77 
78 #endif
79 
Definition: ceptr_types.h:114
void _v_send(VMHost *v, ReceptorAddress from, ReceptorAddress to, Aspect aspect, Symbol carrier, T *contents)
Definition: vmhost.c:194
Xaddr _v_load_receptor_package(VMHost *v, T *p)
Definition: vmhost.c:90
void _v_instantiate_builtins(VMHost *v)
Definition: vmhost.c:324
Xaddr _v_install_r(VMHost *v, Xaddr package, T *bindings, char *label)
Definition: vmhost.c:109
void * __v_process(void *arg)
Definition: vmhost.c:273
void _v_free(VMHost *r)
Definition: vmhost.c:71
receptor implementation header file
Definition: vmhost.h:20
VMHost * _v_new()
Creates a new virtual machine host.
Definition: vmhost.c:41
void _v_send_signals(VMHost *v, T *signals)
Definition: vmhost.c:203
void _v_activate(VMHost *v, Xaddr x)
Definition: vmhost.c:172
SemTable * sem
Semantic Table for definitions on this host.
Definition: vmhost.h:44
Definition: vmhost.h:40
ActiveReceptor active_receptors[MAX_ACTIVE_RECEPTORS]
pointer to array that holds all currently active receptors
Definition: vmhost.h:45
Receptor * r
Receptor data for this vm host.
Definition: vmhost.h:43
void _v_deliver_signals(VMHost *v, Receptor *sender)
Definition: vmhost.c:235