List Info

Thread: "ocaml_beginners"::[] Ocaml and Threading




"ocaml_beginners"::[] Ocaml and Threading
user name
2007-01-07 19:33:28

On 1/7/07, deech_99 < deech_99%40yahoo.com">deech_99yahoo.com> wrote:
&gt; Each of these lights then is a thread that sleeps for a while, wakes
>; up, pings the server, outputs the result to the GUI and goes back to
> sleep.
&gt;
> Given that Ocaml does not have thread support is this possible?

I think it would work ok, if you indeed plan to sleep in the threads
most of the time. I believe the blocking functions (like sleep)
releases the mutex that ensures that only one ocaml thread is running
at a time, letting another thread run. You could use Thread.delay to
sleep the appropriate amount, and you'll probably get a fairly even
distribution of the waking up of threads. Unless there's anything else
that you haven't mentioned about the required workload of an
individual thread, it should work well.

Lars Nilsson

__._,_.___
.

__,_._,___
[1]

about | contact  Other archives ( Real Estate discussion Medical topics )