mirror of
https://github.com/justinethier/cyclone.git
synced 2025-05-19 13:49:16 +02:00
Cleanup
This commit is contained in:
parent
6742142b9d
commit
dbe8597e90
2 changed files with 14 additions and 20 deletions
|
@ -12,7 +12,7 @@
|
||||||
(thread-start!
|
(thread-start!
|
||||||
(make-thread
|
(make-thread
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(thread-sleep! 2000)
|
(thread-sleep! 1200)
|
||||||
(display "started thread, this should be written to console")
|
(display "started thread, this should be written to console")
|
||||||
(newline)
|
(newline)
|
||||||
(display "thread done")
|
(display "thread done")
|
||||||
|
|
32
runtime.c
32
runtime.c
|
@ -5346,6 +5346,9 @@ void *gc_alloc_pair(gc_thread_data *data, object head, object tail)
|
||||||
*/
|
*/
|
||||||
void *Cyc_init_thread(object thread_and_thunk)
|
void *Cyc_init_thread(object thread_and_thunk)
|
||||||
{
|
{
|
||||||
|
vector_type *t;
|
||||||
|
c_opaque_type *o;
|
||||||
|
object op, parent, child;
|
||||||
long stack_start;
|
long stack_start;
|
||||||
gc_thread_data *thd;
|
gc_thread_data *thd;
|
||||||
thd = malloc(sizeof(gc_thread_data));
|
thd = malloc(sizeof(gc_thread_data));
|
||||||
|
@ -5356,17 +5359,14 @@ void *Cyc_init_thread(object thread_and_thunk)
|
||||||
thd->gc_args[0] = &Cyc_91end_91thread_67_primitive;
|
thd->gc_args[0] = &Cyc_91end_91thread_67_primitive;
|
||||||
thd->thread_id = pthread_self();
|
thd->thread_id = pthread_self();
|
||||||
|
|
||||||
// TODO: want to get thread params from calling thread, and probably
|
// Copy thread params from the calling thread
|
||||||
// allocate a new set of cells instead of just assigning this thread's
|
t = (vector_type *)thd->scm_thread_obj;
|
||||||
// params to the parent's params.
|
op = Cyc_vector_ref(thd, t, obj_int2obj(2)); // Field set in thread-start!
|
||||||
|
o = (c_opaque_type *)op;
|
||||||
vector_type *t = (vector_type *)thd->scm_thread_obj;
|
parent = ((gc_thread_data *)o->ptr)->param_objs; // Unbox parent thread's data
|
||||||
object op = Cyc_vector_ref(thd, t, obj_int2obj(2));
|
child = NULL;
|
||||||
c_opaque_type *o = (c_opaque_type *)op;
|
|
||||||
object par = ((gc_thread_data *)o->ptr)->param_objs;
|
|
||||||
object child = NULL;
|
|
||||||
thd->param_objs = NULL;
|
thd->param_objs = NULL;
|
||||||
while (par) {
|
while (parent) {
|
||||||
if (thd->param_objs == NULL) {
|
if (thd->param_objs == NULL) {
|
||||||
thd->param_objs = gc_alloc_pair(thd, NULL, NULL);
|
thd->param_objs = gc_alloc_pair(thd, NULL, NULL);
|
||||||
child = thd->param_objs;
|
child = thd->param_objs;
|
||||||
|
@ -5375,16 +5375,10 @@ void *Cyc_init_thread(object thread_and_thunk)
|
||||||
cdr(child) = p;
|
cdr(child) = p;
|
||||||
child = p;
|
child = p;
|
||||||
}
|
}
|
||||||
car(child) = gc_alloc_pair(thd, car(car(par)), cdr(car(par)));
|
car(child) = gc_alloc_pair(thd, car(car(parent)), cdr(car(parent)));
|
||||||
par = cdr(par);
|
parent = cdr(parent);
|
||||||
}
|
}
|
||||||
// fprintf(stdout, "old: ");
|
// Done initializing parameter objects
|
||||||
// Cyc_display(thd, ((gc_thread_data *)o->ptr)->param_objs, stdout);
|
|
||||||
// fprintf(stdout, "\n");
|
|
||||||
// fprintf(stdout, "new: ");
|
|
||||||
// Cyc_display(thd, thd->param_objs, stdout);
|
|
||||||
// fprintf(stdout, "\n");
|
|
||||||
// END TODO
|
|
||||||
|
|
||||||
gc_add_mutator(thd);
|
gc_add_mutator(thd);
|
||||||
ck_pr_cas_int((int *)&(thd->thread_state), CYC_THREAD_STATE_NEW,
|
ck_pr_cas_int((int *)&(thd->thread_state), CYC_THREAD_STATE_NEW,
|
||||||
|
|
Loading…
Add table
Reference in a new issue