Return-Path: william@bourbon.usc.edu Delivery-Date: Mon Oct 27 08:47:24 2008 X-Spam-Checker-Version: SpamAssassin 3.2.3 (2007-08-08) on merlot.usc.edu X-Spam-Level: X-Spam-Status: No, score=-2.3 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.3 Received: from bourbon.usc.edu (bourbon.usc.edu [128.125.9.75]) by merlot.usc.edu (8.14.1/8.14.1) with ESMTP id m9RFlOHN021571 for ; Mon, 27 Oct 2008 08:47:24 -0700 Received: from bourbon.usc.edu (localhost.localdomain [127.0.0.1]) by bourbon.usc.edu (8.14.2/8.14.1) with ESMTP id m9RFwIdj005662 for ; Mon, 27 Oct 2008 08:58:18 -0700 Message-Id: <200810271558.m9RFwIdj005662@bourbon.usc.edu> To: cs551@merlot.usc.edu Subject: Re: CS 551 Date: Mon, 27 Oct 2008 08:58:18 -0700 From: Bill Cheng Someone wrote: > I am using alarm to keep track of keep alive messages. I am resetting it > everytime i get a keepalive message. However, alarm(time) is a process > specific function and thus all threads share it. If A is connected to B and > C , and say B goes down then too the alarm doesnt go off for A since the > node C is still alive and keeps resetting the alarm. Is there some way to > make the alarm thread specific or is there a work around for the same ? Please don't use alarm for this! You should use one alarm for auto-shutdown. I've described how to handle timers at the end of lecture 9. You should go back to watch the lecture video. By the way, I'm not sure what you meant by "all threads share it". Are you saying that if you have a thread which blocks SIGALRM and it is blocked at sigwait() and you send SIGALRM to it, it will get the signal anyway?! That seems weird. -- Bill Cheng // bill.cheng@usc.edu