From owner-freebsd-hackers@FreeBSD.ORG Fri Nov 2 05:14:17 2007 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4A2DF16A417 for ; Fri, 2 Nov 2007 05:14:17 +0000 (UTC) (envelope-from ioplex@gmail.com) Received: from rv-out-0910.google.com (rv-out-0910.google.com [209.85.198.188]) by mx1.freebsd.org (Postfix) with ESMTP id 28BDD13C4B0 for ; Fri, 2 Nov 2007 05:14:17 +0000 (UTC) (envelope-from ioplex@gmail.com) Received: by rv-out-0910.google.com with SMTP id l15so575604rvb for ; Thu, 01 Nov 2007 22:13:46 -0700 (PDT) Received: by 10.143.16.9 with SMTP id t9mr365009wfi.1193961747982; Thu, 01 Nov 2007 17:02:27 -0700 (PDT) Received: by 10.142.164.5 with HTTP; Thu, 1 Nov 2007 17:02:27 -0700 (PDT) Message-ID: <78c6bd860711011702k78e0aa3dy725c1a2d9c690c1b@mail.gmail.com> Date: Thu, 1 Nov 2007 20:02:27 -0400 From: "Michael B Allen" To: "Peter Jeremy" In-Reply-To: <20071101195123.GJ25671@server.vk2pj.dyndns.org> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <78c6bd860711011041o6d10753an663f19389737f84b@mail.gmail.com> <20071101195123.GJ25671@server.vk2pj.dyndns.org> Cc: freebsd-hackers Subject: Re: timers and semtimedop(2) X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Nov 2007 05:14:17 -0000 On 11/1/07, Peter Jeremy wrote: > On Thu, Nov 01, 2007 at 01:41:10PM -0400, Michael B Allen wrote: > >I need semtimedop(2). I'm thinking I can just do a semop with a SIGINT maybe. > > I presume you mean SIGALRM. > > >Can someone suggest a good method for setting up a timer to deliver > >the signal? What sort of timers does FreeBSD offer? > > Assuming you aren't planning on creating a new syscall: man setitimer > There's also kqueue EVFILT_TIMER but that is probably only useful if > you are already using kqueue for other purposes. Hi Peter, On second thought I decided to use the application's existing event loop to call semop and notify the waiter. It's not a self contained solution and it won't work if the event loop itself is the waiter but it it almost always pays not to use signals if you don't absolutely have to. Thanks, Mike