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: Likai Liu <liulk@b...>
Subject: Re: [Caml-list] PortAudio on ocaml
> > is a "leave_blocking_section()" call enough to guarentee that?
>
> If the callback is invoked in a thread, yes.  But then you are back
> to square 1: leave_blocking_section will wait for the master lock,
> and your program is not real-time.

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?

I think at the end, more speculation probably won't help much. I think 
I should just try different ways and do ad-hoc experiments to see which 
ones actually work acceptably, in the presence of garbage collection, 
interrupting signals, other threads, etc. If none of them work, at 
least there is a blocking I/O interface left for O'Caml.

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?

liulk