* [Caml-list] lib design questions
@ 2004-03-29 11:41 Richard Nyberg
0 siblings, 0 replies; only message in thread
From: Richard Nyberg @ 2004-03-29 11:41 UTC (permalink / raw)
To: caml-list
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2004-03-29 11:41 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-03-29 11:41 [Caml-list] lib design questions Richard Nyberg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox