[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: threads & gc
From: |
Jim Blandy |
Subject: |
Re: threads & gc |
Date: |
16 Sep 2000 08:37:57 -0500 |
> * assuming we know about all running threads, we just suspend them
> "from the outside".
>
> this would require:
>
> * either a way to enumerate all threads in the process or a
> requirement that all Guile-using threads are started with a
> Guile-specific "pthread_create" wrapper.
POSIX Threads provides no such enumeration interface. I suspect the
wrapper is the way to go; the thing to watch out for then is keeping
the list accurate when threads exit / die / whatever.
> * a way to suspend a thread from another thread. I can't find such
> a thing in pthreads, maybe I'm looking in a wrong place?
`pthread_kill' is probably your best bet.
> * the "cooperative" way: there are "checkpoints" before each cons and
> periodically in the evaluator.
>
> this means that when GC occurs, no thread can be in the "just got a
> new cell and it's half-initialized and now I'm suspended" state, so
> life is good.
You need to make sure that threads blocked in I/O are considered to be
"at a checkpoint". This might be interesting.