Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] PortAudio on ocaml
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Damien Doligez <Damien.Doligez@i...>
Subject: Re: [Caml-list] PortAudio on ocaml
On Saturday, July 19, 2003, at 03:37 PM, Likai Liu wrote:

> So what about the alternative option, as Xavier suggested earlier, to 
> enter an event loop that that waits in an "enter_blocking_section" 
> call with threads but no other running threads, and then callbacks are 
> made during the loop one at a time?

You would have a Caml thread that does "enter_blocking_section" to
release the master lock, then wait for callbacks.  When a callback
occurs, you need to "leave_blocking_section", do the work, then
"enter_blocking_section" again before returning from the callback.


> Speak of which, if I write a C function that blocks, does the bytecode 
> thread scheduler know how to schedule other threads during the mean 
> time? And native threads?

This is the whole purpose of the "enter_blocking_section" and
"leave_blocking_section" calls: to tell the scheduler that it can
schedule another thread.

-- Damien

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners