[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Sylvain LE GALL <sylvain.le-gall@p...> |
| Subject: | Re: [Caml-list] threads |
On Tue, Mar 19, 2002 at 06:59:38PM -0800, Francois Rouaix wrote: > Is anyone using native threads in Ocaml 3.04 intensively on Linux these > days ? > I'm playing with a Gnutella servent, and I'm experimenting crashes > (bytecode and native). > I'm using the unix library heavily. So far, I'm aware that the DNS calls > are not reentrant, > but the rest of the library calls should be okay. > Hello, I have tried this days to play with thread and mutex and condition. Very funny but very messy. I do not use native thread but the problem is that each thread is a process and when you exit because of a problem the main thread if the child thread is detached, you can't make it ending. A lot of problem also with signal handling ( a simple CtrL-C ). Each thread catch it on is own... Not very simple. Of course i'm pretty sure thread is very useful in certain situation but i think you can think about using a non threaded process ( convert my program to this using state for each object and a select on the different socket ... it has speed up the program ). Thread have cause me also a lot of crash and non ending thread. I have also a very non caml error : Segmentation Fault ( i do believe this can not exist in Caml but now ... ) Sylvain LE GALL. (of course if you intersted in getting your code in a non threaded version i give you my solution... i know that all people in the list will laugh at it because i am nearby a beginner : type tcp_client_state = TCP_Waiting | TCP_Connected | TCP_Stopped in my object method run = match self#acq_state with TCP_Waiting -> self#waiting TCP_Connected -> self#connected in the parent method run = let (ready,_,_) = Unix.select self#list_socket [] [] delay_select in (* si les données dispo on réveille l'objet correspondant *) (* pour le serveur *) try while true do self#add_sortant done with Unix.Unix_error(Unix.EAGAIN,_,_) -> () ------------------- 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