* [Caml-list] C callbacks and threading...
@ 2001-09-27 9:34 Chris Quinn
2001-09-27 13:20 ` Xavier Leroy
0 siblings, 1 reply; 3+ messages in thread
From: Chris Quinn @ 2001-09-27 9:34 UTC (permalink / raw)
To: CAML LIST
Hi list,
The manual says a caml function can be registered and then used from the C runtime. Is this still true if called from a thread not created from within Caml ie. via the Thread module? I have vague recollections of caml's thread system involving some bookkeeping which probably rules this usage out.
Can anyone say?
Thanks,
Chris Q
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Caml-list] C callbacks and threading...
2001-09-27 9:34 [Caml-list] C callbacks and threading Chris Quinn
@ 2001-09-27 13:20 ` Xavier Leroy
2001-09-27 13:49 ` [Caml-list] Mac and C-code Ward Wheeler
0 siblings, 1 reply; 3+ messages in thread
From: Xavier Leroy @ 2001-09-27 13:20 UTC (permalink / raw)
To: Chris Quinn; +Cc: CAML LIST
> The manual says a caml function can be registered and then used from
> the C runtime. Is this still true if called from a thread not
> created from within Caml ie. via the Thread module? I have vague
> recollections of caml's thread system involving some bookkeeping
> which probably rules this usage out.
It should work if:
- the Caml code doesn't use threads itself;
- you call it via callback_exn rather than callback (to make sure you
always get control back from the Caml code);
- you protect the call to callback_exn by a mutex, to make sure that
no two threads can call into Caml simultaneously.
In all other cases, and especially if the Caml code is multithreaded,
you would probably break something in the Caml runtime system.
- Xavier Leroy
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2001-09-27 13:56 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-09-27 9:34 [Caml-list] C callbacks and threading Chris Quinn
2001-09-27 13:20 ` Xavier Leroy
2001-09-27 13:49 ` [Caml-list] Mac and C-code Ward Wheeler
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox