Added spec:commit task to commit changes to spec/ruby sources.
[rbx.git] / shotgun / lib / environment.h
blob6e18505674f3e61486a6204e3dc72d80e86b21cb
1 #ifndef RBS_ENVIRON_H
2 #define RBS_ENVIRON_H
4 #include <ev.h>
5 #include "shotgun/lib/machine.h"
7 /*
8 Rubinius environment stores load paths,
9 platform configuration, list of spawned machines,
10 event loop
11 and synchronization mutex.
13 One environment is automatically created on
14 VM start.
16 Each environment lives in it's own pthread
18 struct rubinius_environment {
19 pthread_mutex_t mutex;
20 struct hashtable *machines;
21 char *platform_config;
22 char *bootstrap_path;
23 char *platform_path;
24 char *core_path;
25 char *loader_path;
27 int machine_id;
29 struct hashtable *messages;
30 struct ev_loop *sig_event_base;
31 struct ev_signal sig_ev;
34 typedef struct rubinius_environment *environment;
36 struct rubinius_global {
37 environment e;
38 machine m;
41 environment environment_new();
42 void environment_at_startup();
43 void environment_setup_thread(environment e, machine m);
44 environment environment_current();
45 machine environment_current_machine();
46 void environment_add_machine(environment e, machine m);
47 int environment_del_machine(environment e, machine m);
48 int environment_load_machine(environment e, machine m);
49 void environment_start_thread(environment e, machine m);
50 void environment_exit_machine();
51 int environment_join_machine(environment e, int id);
52 void environment_fork();
54 void environment_send_message(environment e, int id, OBJECT msg);
55 OBJECT environment_get_message(environment e, int id);
58 #endif