From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: To: 9fans@9fans.net Date: Tue, 14 Jul 2009 16:47:44 +0200 From: cinap_lenrek@gmx.de In-Reply-To: <4A5C9454.9080801@tecmav.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="upas-aktzetkhimeyjepaasilrwjmgn" Subject: Re: [9fans] A question about timeout Topicbox-Message-UUID: 1fdaeeb6-ead5-11e9-9d60-3106f5b1d025 This is a multi-part message in MIME format. --upas-aktzetkhimeyjepaasilrwjmgn Content-Disposition: inline Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit to interrupt on i/o operations you send a note to the process. for ioproc(2), here is iointerrupt() that does that. for timeouts here is a alarm() function (see sleep(2)) that will fire a note on you when the alarm expires. notes should also work for rendezvous()/alt(), but a better way is to include a timeout/cancel channel in your alt() operation. as a example see /sys/src/cmd/rio/time.c. here we have a central timer process that does a sleep and sends a message to channels associated with timers when they expire. -- cinap --upas-aktzetkhimeyjepaasilrwjmgn Content-Type: message/rfc822 Content-Disposition: inline Return-Path: <9fans-bounces+cinap_lenrek=gmx.de@9fans.net> X-Flags: 0000 Delivered-To: GMX delivery to cinap_lenrek@gmx.de Received: (qmail invoked by alias); 14 Jul 2009 14:28:46 -0000 Received: from gouda.swtch.com (EHLO gouda.swtch.com) [67.207.142.3] by mx0.gmx.net (mx039) with SMTP; 14 Jul 2009 16:28:46 +0200 Received: from localhost ([127.0.0.1] helo=gouda.swtch.com) by gouda.swtch.com with esmtp (Exim 4.69) (envelope-from <9fans-bounces@9fans.net>) id 1MQivW-00073C-Fc; Tue, 14 Jul 2009 14:24:14 +0000 Received: from smtp7.aruba.it ([62.149.128.206] helo=smtp6.aruba.it) by gouda.swtch.com with smtp (Exim 4.69) (envelope-from ) id 1MQivT-000737-CN for 9fans@9fans.net; Tue, 14 Jul 2009 14:24:11 +0000 Received: (qmail 20907 invoked by uid 89); 14 Jul 2009 14:24:02 -0000 Received: from unknown (HELO ?10.11.12.14?) (a.verardo@tecmav.com@213.136.145.12) by smtp6.aruba.it with SMTP; 14 Jul 2009 14:24:02 -0000 Message-ID: <4A5C9454.9080801@tecmav.com> Date: Tue, 14 Jul 2009 16:21:08 +0200 From: Adriano Verardo User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7.13) Gecko/20080213 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Rating: smtp6.aruba.it 1.6.2 0/1000/N Subject: [9fans] A question about timeout X-BeenThere: 9fans@9fans.net X-Mailman-Version: 2.1.10 Precedence: list Reply-To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> List-Id: Fans of the OS Plan 9 from Bell Labs <9fans.9fans.net> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: 9fans-bounces@9fans.net Errors-To: 9fans-bounces+cinap_lenrek=gmx.de@9fans.net X-GMX-Antivirus: 0 (no virus found) X-GMX-Antispam: 0 (Mail was not recognized as spam) X-GMX-UID: JqRlf05yeWU7Npcm0HVzyzM5U3U4N8+V I'm porting some Unix applications which implement a timeout on read/write/accept/... calls using select(). In previous versions I did the same by signals but with problems due to the behaviour of the interrupted system call. Select() is also used to choose among channels waiting for I/O. How can I implement channel selection and secure timeouts without using APE ? Re-write some pieces is not a problem, I prefer a "pure" 8c implementation. adriano --upas-aktzetkhimeyjepaasilrwjmgn--