Return-Path: william@bourbon.usc.edu Delivery-Date: Thu Sep 25 22:12:04 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 m8Q5C3qs022659 for ; Thu, 25 Sep 2008 22:12:04 -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 m8Q5FJh4001895 for ; Thu, 25 Sep 2008 22:15:19 -0700 Message-Id: <200809260515.m8Q5FJh4001895@bourbon.usc.edu> To: cs551@merlot.usc.edu Subject: Re: Regarding ctrl+C Date: Thu, 25 Sep 2008 22:15:19 -0700 From: Bill Cheng Someone wrote: > I have a question about the signal handling. Suppose my arrival thread > has already put 2 customer in the customer queue. The arrival thread is > currently sleeping for fill up the interarrival time of the 3rd > customer. Suppose the interarrival of the 3rd customer is 10secs. Thus > arrival thread sleeps for 10 secs, so it will go in waiting processes > queue. In this time, ont of the server threads will run. What if I press > ctrl C in this time? The arrival thread who was responsible for handling > this signal will not catch the signal (as it is on waiting queue). > Should we handle ctrl C in S1 and S2 also? This problem doesn't happen > frequently, but it can be seen in sample trace file when ctrl C is > pressed after 11secs. If you call select() or usleep() to sleep in your arrival thread, select() or usleep() should return with an error condition and errno should be set to EINTR. If this is not happening, may be you did not setup the sigmask correctly. Please do: man pthread_sigmask to see how to catch in pthread. -- Bill Cheng // bill.cheng@usc.edu