From: SooHyoung Oh <shoh@compiler.kaist.ac.kr>
To: Markus Mottl <markus.mottl@gmail.com>
Cc: OCaml <caml-list@inria.fr>
Subject: Re: [Caml-list] C-threads & callbacks
Date: Fri, 21 Jan 2005 10:16:02 +0900 [thread overview]
Message-ID: <41F057D2.4020407@compiler.kaist.ac.kr> (raw)
In-Reply-To: <20050120182313.GB4919@quant3.janestcapital.quant>
I'v resolved the same problem using TCP/IP communication between
Ocaml thread and C thread.
Markus Mottl 쓴 글:
>Hi,
>
>I'm currently interfacing a 3rd-party library that spawns threads
>to execute callbacks. I would like those callbacks to be handled by
>OCaml-code, but have run into some issues here.
>
>As it seems, it is not possible to run OCaml-code linked with thread
>support while letting C-threads perform callbacks. This has already
>been a topic on the list a while ago.
>
>I have two solutions in mind: the first one would involve pre-spawning
>an OCaml-thread and pass data from C to OCaml through an OCaml-reference
>exposed to C, protected by mutexes and condition variables. This seems
>pretty ugly, because it's error-prone and also involves a considerable
>amount of context-switching, which is bad for my application (very high
>volume realtime data).
>
>The second solution would require setting up an OCaml thread descriptor
>for the currently executing C-thread. However, AFAIK this solution
>cannot be implemented without fiddling with the implementation of the
>OCaml-runtime, because some global variables for thread-handling are not
>exposed to user code (i.e. "static"). It would be great if the thread
>implementation offered functions allowing users to have their C-threads
>"migrate" to OCaml.
>
>Does anybody know of another elegant and efficient solution for this
>problem that does not require hacking the OCaml-runtime?
>
>Best regards,
>Markus
>
>_______________________________________________
>Caml-list mailing list. Subscription management:
>http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
>Archives: http://caml.inria.fr
>Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
>Bug reports: http://caml.inria.fr/bin/caml-bugs
>
>
>
next prev parent reply other threads:[~2005-01-21 1:16 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-01-20 18:23 Markus Mottl
2005-01-20 18:58 ` [Caml-list] " Daniel Bünzli
2005-01-20 19:23 ` Markus Mottl
2005-01-20 19:37 ` Alex Baretta
2005-01-20 20:19 ` Markus Mottl
2005-01-21 1:16 ` SooHyoung Oh [this message]
2005-01-21 6:42 ` Alex Baretta
[not found] ` <200501211042.31749.vincenzo_mlRE.MOVE@yahoo.it>
2005-01-24 20:00 ` Markus Mottl
2005-01-30 10:19 ` [Caml-list] " Xavier Leroy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=41F057D2.4020407@compiler.kaist.ac.kr \
--to=shoh@compiler.kaist.ac.kr \
--cc=caml-list@inria.fr \
--cc=markus.mottl@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox