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 QAA02288; Mon, 9 Sep 2002 16:15:30 +0200 (MET DST) 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 QAA02264 for ; Mon, 9 Sep 2002 16:15:29 +0200 (MET DST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id g89EFS113391; Mon, 9 Sep 2002 16:15:28 +0200 (MET DST) Received: (from xleroy@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id QAA02733; Mon, 9 Sep 2002 16:15:27 +0200 (MET DST) Date: Mon, 9 Sep 2002 16:15:27 +0200 From: Xavier Leroy To: Dmitry Bely Cc: caml-list@inria.fr Subject: Re: [Caml-list] Inter-thread exceptions Message-ID: <20020909161527.C1781@pauillac.inria.fr> References: <20020903164851.A26567@kruuna.Helsinki.FI> <20020905133052.C5343@pauillac.inria.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0i In-Reply-To: ; from dbely@mail.ru on Fri, Sep 06, 2002 at 10:22:13PM +0400 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk > Nethertheless I think it's possible for network I/O, and even portable > enough (should work under pthreads/windows threads). Roughly the idea is > following: > > 0. Create a global "interrupt" socket. > 1. Perform select() before each blocking syscall, waiting for readability > of "interrupt" socket or the necessary state of "main" socket. > 3. If "main" socket was in the necessary state, do the syscall. > 4. If "interrupt" socket is readable, determine interrupt to which thread > is requested. If it's other thread, call sched_yield() for pthreads > (nothing under Windows) and return to (1) For one thing, not all blocking syscalls can be made non-blocking using select(). (Think opening a FIFO, for instance.) Moreover, not all blocking syscalls are in C code that we control. (Think gethostbyname(): it will do network I/O to query the DNS, but in a way that we don't control.) - Xavier Leroy ------------------- 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