mirror of
https://github.com/justinethier/cyclone.git
synced 2025-07-16 17:27:33 +02:00
Added thread primitives
This commit is contained in:
parent
7d57cec8a6
commit
a539027b0f
5 changed files with 16 additions and 9 deletions
|
@ -226,8 +226,8 @@ extern const object primitive_Cyc_91get_91cvar;
|
||||||
extern const object primitive_Cyc_91set_91cvar_67;
|
extern const object primitive_Cyc_91set_91cvar_67;
|
||||||
extern const object primitive_Cyc_91cvar_127;
|
extern const object primitive_Cyc_91cvar_127;
|
||||||
extern const object primitive_Cyc_91has_91cycle_127;
|
extern const object primitive_Cyc_91has_91cycle_127;
|
||||||
extern const object primitive_Cyc_91spawn_91thread_127;
|
extern const object primitive_Cyc_91spawn_91thread_67;
|
||||||
extern const object primitive_Cyc_91end_91thread_127;
|
extern const object primitive_Cyc_91end_91thread_67;
|
||||||
extern const object primitive__87;
|
extern const object primitive__87;
|
||||||
extern const object primitive__91;
|
extern const object primitive__91;
|
||||||
extern const object primitive__85;
|
extern const object primitive__85;
|
||||||
|
|
14
runtime.c
14
runtime.c
|
@ -1702,11 +1702,11 @@ void _set_91cdr_67(void *data, object cont, object args) {
|
||||||
void _Cyc_91has_91cycle_127(void *data, object cont, object args) {
|
void _Cyc_91has_91cycle_127(void *data, object cont, object args) {
|
||||||
Cyc_check_num_args(data, "Cyc-has-cycle?", 1, args);
|
Cyc_check_num_args(data, "Cyc-has-cycle?", 1, args);
|
||||||
return_closcall1(data, cont, Cyc_has_cycle(car(args))); }
|
return_closcall1(data, cont, Cyc_has_cycle(car(args))); }
|
||||||
void _Cyc_91spawn_91thread_127(void *data, object cont, object args) {
|
void _Cyc_91spawn_91thread_67(void *data, object cont, object args) {
|
||||||
Cyc_check_num_args(data, "Cyc-spawn-thread!", 1, args);
|
Cyc_check_num_args(data, "Cyc-spawn-thread!", 1, args);
|
||||||
// TODO: validate argument type?
|
// TODO: validate argument type?
|
||||||
return_closcall1(data, cont, Cyc_spawn_thread(car(args))); }
|
return_closcall1(data, cont, Cyc_spawn_thread(car(args))); }
|
||||||
void _Cyc_91end_91thread_127(void *data, object cont, object args) {
|
void _Cyc_91end_91thread_67(void *data, object cont, object args) {
|
||||||
Cyc_check_num_args(data, "Cyc-end-thread!", 0, args);
|
Cyc_check_num_args(data, "Cyc-end-thread!", 0, args);
|
||||||
Cyc_end_thread((gc_thread_data *)data);
|
Cyc_end_thread((gc_thread_data *)data);
|
||||||
return_closcall1(data, cont, boolean_f); }
|
return_closcall1(data, cont, boolean_f); }
|
||||||
|
@ -2896,8 +2896,8 @@ static primitive_type Cyc_91get_91cvar_primitive = {{0}, primitive_tag, "Cyc-get
|
||||||
static primitive_type Cyc_91set_91cvar_67_primitive = {{0}, primitive_tag, "Cyc-set-cvar!", &_Cyc_91set_91cvar_67};
|
static primitive_type Cyc_91set_91cvar_67_primitive = {{0}, primitive_tag, "Cyc-set-cvar!", &_Cyc_91set_91cvar_67};
|
||||||
static primitive_type Cyc_91cvar_127_primitive = {{0}, primitive_tag, "Cyc-cvar?", &_Cyc_91cvar_127};
|
static primitive_type Cyc_91cvar_127_primitive = {{0}, primitive_tag, "Cyc-cvar?", &_Cyc_91cvar_127};
|
||||||
static primitive_type Cyc_91has_91cycle_127_primitive = {{0}, primitive_tag, "Cyc-has-cycle?", &_Cyc_91has_91cycle_127};
|
static primitive_type Cyc_91has_91cycle_127_primitive = {{0}, primitive_tag, "Cyc-has-cycle?", &_Cyc_91has_91cycle_127};
|
||||||
static primitive_type Cyc_91spawn_91thread_127_primitive = {{0}, primitive_tag, "Cyc-spawn-thread!", &_Cyc_91spawn_91thread_127};
|
static primitive_type Cyc_91spawn_91thread_67_primitive = {{0}, primitive_tag, "Cyc-spawn-thread!", &_Cyc_91spawn_91thread_67};
|
||||||
static primitive_type Cyc_91end_91thread_127_primitive = {{0}, primitive_tag, "Cyc-end-thread!", &_Cyc_91end_91thread_127};
|
static primitive_type Cyc_91end_91thread_67_primitive = {{0}, primitive_tag, "Cyc-end-thread!", &_Cyc_91end_91thread_67};
|
||||||
static primitive_type _87_primitive = {{0}, primitive_tag, "+", &__87};
|
static primitive_type _87_primitive = {{0}, primitive_tag, "+", &__87};
|
||||||
static primitive_type _91_primitive = {{0}, primitive_tag, "-", &__91};
|
static primitive_type _91_primitive = {{0}, primitive_tag, "-", &__91};
|
||||||
static primitive_type _85_primitive = {{0}, primitive_tag, "*", &__85};
|
static primitive_type _85_primitive = {{0}, primitive_tag, "*", &__85};
|
||||||
|
@ -3015,8 +3015,8 @@ const object primitive_Cyc_91get_91cvar = &Cyc_91get_91cvar_primitive;
|
||||||
const object primitive_Cyc_91set_91cvar_67 = &Cyc_91set_91cvar_67_primitive;
|
const object primitive_Cyc_91set_91cvar_67 = &Cyc_91set_91cvar_67_primitive;
|
||||||
const object primitive_Cyc_91cvar_127 = &Cyc_91cvar_127_primitive;
|
const object primitive_Cyc_91cvar_127 = &Cyc_91cvar_127_primitive;
|
||||||
const object primitive_Cyc_91has_91cycle_127 = &Cyc_91has_91cycle_127_primitive;
|
const object primitive_Cyc_91has_91cycle_127 = &Cyc_91has_91cycle_127_primitive;
|
||||||
const object primitive_Cyc_91spawn_91thread_127 = &Cyc_91spawn_91thread_127_primitive;
|
const object primitive_Cyc_91spawn_91thread_67 = &Cyc_91spawn_91thread_67_primitive;
|
||||||
const object primitive_Cyc_91end_91thread_127 = &Cyc_91end_91thread_127_primitive;
|
const object primitive_Cyc_91end_91thread_67 = &Cyc_91end_91thread_67_primitive;
|
||||||
const object primitive__87 = &_87_primitive;
|
const object primitive__87 = &_87_primitive;
|
||||||
const object primitive__91 = &_91_primitive;
|
const object primitive__91 = &_91_primitive;
|
||||||
const object primitive__85 = &_85_primitive;
|
const object primitive__85 = &_85_primitive;
|
||||||
|
@ -3140,7 +3140,7 @@ void *Cyc_init_thread(object thunk)
|
||||||
gc_thread_data_init(thd, 0, (char *) &stack_start, global_stack_size);
|
gc_thread_data_init(thd, 0, (char *) &stack_start, global_stack_size);
|
||||||
thd->gc_cont = thunk;
|
thd->gc_cont = thunk;
|
||||||
thd->gc_num_args = 1;
|
thd->gc_num_args = 1;
|
||||||
thd->gc_args[0] = &Cyc_91end_91thread_127_primitive;
|
thd->gc_args[0] = &Cyc_91end_91thread_67_primitive;
|
||||||
gc_add_mutator(thd);
|
gc_add_mutator(thd);
|
||||||
Cyc_start_thread(thd);
|
Cyc_start_thread(thd);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
@ -450,6 +450,8 @@
|
||||||
((eq? p 'Cyc-set-cvar!) "Cyc_set_cvar")
|
((eq? p 'Cyc-set-cvar!) "Cyc_set_cvar")
|
||||||
((eq? p 'Cyc-cvar?) "Cyc_is_cvar")
|
((eq? p 'Cyc-cvar?) "Cyc_is_cvar")
|
||||||
((eq? p 'Cyc-has-cycle?) "Cyc_has_cycle")
|
((eq? p 'Cyc-has-cycle?) "Cyc_has_cycle")
|
||||||
|
((eq? p 'Cyc-spawn-thread!) "Cyc_spawn_thread")
|
||||||
|
((eq? p 'Cyc-end-thread!) "Cyc_end_thread")
|
||||||
((eq? p 'Cyc-stdout) "Cyc_stdout")
|
((eq? p 'Cyc-stdout) "Cyc_stdout")
|
||||||
((eq? p 'Cyc-stdin) "Cyc_stdin")
|
((eq? p 'Cyc-stdin) "Cyc_stdin")
|
||||||
((eq? p 'Cyc-stderr) "Cyc_stderr")
|
((eq? p 'Cyc-stderr) "Cyc_stderr")
|
||||||
|
@ -580,6 +582,7 @@
|
||||||
<=
|
<=
|
||||||
apply
|
apply
|
||||||
Cyc-default-exception-handler
|
Cyc-default-exception-handler
|
||||||
|
Cyc-end-thread!
|
||||||
open-input-file
|
open-input-file
|
||||||
open-output-file
|
open-output-file
|
||||||
close-port
|
close-port
|
||||||
|
|
|
@ -451,6 +451,8 @@
|
||||||
Cyc-set-cvar!
|
Cyc-set-cvar!
|
||||||
Cyc-cvar? ;; Cyclone-specific
|
Cyc-cvar? ;; Cyclone-specific
|
||||||
Cyc-has-cycle?
|
Cyc-has-cycle?
|
||||||
|
Cyc-spawn-thread!
|
||||||
|
Cyc-end-thread!
|
||||||
Cyc-stdout
|
Cyc-stdout
|
||||||
Cyc-stdin
|
Cyc-stdin
|
||||||
Cyc-stderr
|
Cyc-stderr
|
||||||
|
|
|
@ -136,6 +136,8 @@
|
||||||
(list 'Cyc-set-cvar! Cyc-set-cvar!)
|
(list 'Cyc-set-cvar! Cyc-set-cvar!)
|
||||||
(list 'Cyc-cvar? Cyc-cvar?)
|
(list 'Cyc-cvar? Cyc-cvar?)
|
||||||
(list 'Cyc-has-cycle? Cyc-has-cycle?)
|
(list 'Cyc-has-cycle? Cyc-has-cycle?)
|
||||||
|
(list 'Cyc-spawn-thread! Cyc-spawn-thread!)
|
||||||
|
(list 'Cyc-end-thread! Cyc-end-thread!)
|
||||||
(list 'Cyc-default-exception-handler Cyc-default-exception-handler)
|
(list 'Cyc-default-exception-handler Cyc-default-exception-handler)
|
||||||
(list 'Cyc-current-exception-handler Cyc-current-exception-handler)
|
(list 'Cyc-current-exception-handler Cyc-current-exception-handler)
|
||||||
(list '+ +)
|
(list '+ +)
|
||||||
|
|
Loading…
Add table
Reference in a new issue