Browse thread
Typing problem
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Xavier Leroy <Xavier.Leroy@i...> |
| Subject: | Re: Thread feature missing |
> Have I miss something ? I found that two features (especialy the first) > are missing in the thread library: No, you didn't miss anything. The OCaml thread interface is somehow constrained to the intersection of what can be implemented on top of the virtual machine (for bytecode threads) and of what POSIX and Win32 threads provide (for system threads). > - No way to wait for one thread to finish among many (equivalent of > join, but taking a list of threads as argument) This isn't supported directly in POSIX threads. However, you can easily program it yourself using e.g. events: allocate a channel, have each thread send a message on it when it terminates, and wait for a message on the channel. The good thing about this method is that you can put whatever you need in the message (thread ID, return value, etc). > - No way to send a signal to a thread (it would be useful to make a > thread raise an exception from another thread). I agree this would be nice, and can easily be implemented in the case of bytecode threads. For POSIX threads, one could try using cancellation to handle this, but I'm not sure it can be done in a portable way. For Win32 threads, I don't know how to do it. - Xavier Leroy