From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id LAA12342; Wed, 20 Mar 2002 11:51:57 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id LAA08511 for ; Wed, 20 Mar 2002 11:51:56 +0100 (MET) Received: from x-mailer.polytechnique.fr (x-mailer.polytechnique.fr [129.104.35.1]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id g2KApt928148 for ; Wed, 20 Mar 2002 11:51:55 +0100 (MET) Received: from gallu (mail@[129.104.205.147]) by x-mailer.polytechnique.fr (x.y.z/x.y.z) with ESMTP id LAA03167; Wed, 20 Mar 2002 11:51:59 +0100 (MET) Received: from gildor by gallu with local (Exim 3.35 #1 (Debian)) id 16ndk6-0000kL-00; Wed, 20 Mar 2002 11:54:54 +0100 Date: Wed, 20 Mar 2002 11:54:54 +0100 To: Francois Rouaix Cc: caml-list@inria.fr Subject: Re: [Caml-list] threads Message-ID: <20020320105454.GA1297@gallu.polytechnique.fr> References: <000001c1cfbb$460b3c60$ca01a8c0@homebox> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <000001c1cfbb$460b3c60$ca01a8c0@homebox> User-Agent: Mutt/1.3.27i From: Sylvain LE GALL Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk 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