From: Richard Nyberg <rnyberg@it.su.se>
To: caml-list@inria.fr
Subject: [Caml-list] lib design questions
Date: Mon, 29 Mar 2004 13:41:23 +0200 [thread overview]
Message-ID: <m18yhjx4m4.wl@murmeldjur.it.su.se> (raw)
Hello ocaml demi gods :)
I'm trying to write a library for a network protocol (xmpp).
I thought I could do it with a network of threads and the Event
system that ocaml has. The design I have now is like this:
[Thread 3] is always running and is kind of a message distribution
hub. [Thread 1] and [Thread 2] is created for every connection and
are there to read data from the connection and giving full protocol
messages to [Thread 3].
[Thread 1]
reads data from network
send data on ch_1to2
[Thread 2]
receive data on ch_1to2 until we have parsed a protocol message
send message on ch_2to3
[Thread 3]
Select
receive protocol messages on ch_2to3
receive servers request on req_ch
...
send protocol messages on some channels
Question 1:
Sometimes it is necessary to replace [Thread 1] and [Thread 2]
with a new pair of thread for a connection (startssl and sasl).
How can I do that? Is it always safe do do Thread.kill on them?
Question 2:
Is this design totally idiotic? Do you have design patterns
for asynchronous message protocols?
Happy hacking!
-Richard
-------------------
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
reply other threads:[~2004-03-29 11:41 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=m18yhjx4m4.wl@murmeldjur.it.su.se \
--to=rnyberg@it.su.se \
--cc=caml-list@inria.fr \
/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