On 29-Jan-08, at 3:27 PM, François Magnan wrote:
Hello,
I am experiencing a strange bug in my code that would be long to explain. To resume the context, I have many threads running in parallel, some open-process IO, some tcp-server IO and some termite processes. At some point all the threads become blocked indefinitely and the program sleeps forever.
Are these problems occurring on Mac OS X? Could you describe what processes you start with open-process? I'm asking because I recently fixed a bug in open-process.
I stumbled on the following paragraph in the threads section of the Gambit doc:
``A thread is blocked if it is waiting for a mutex to become unlocked, an I/O operation to become possible, the end of a “sleep” period, etc. ''
I think this may lead me to a solution to my bug but I don't clearly understand the statement. Could there be an IO operation that blocks all my threads? Any help would be greatly appreciated.
You have to beware of C functions that are called from the Scheme world. If the C function performs an I/O operation, or a "sleep", or a "wait" on a process, or acquire a mutex, and the operation blocks then the Scheme thread scheduler will never get a chance to schedule another Scheme thread. Some Scheme functions which rely on C library functions that can block, such as host-info, also have the same issue.
Marc