in reply to Re: Re: Catching signals
in thread Catching signals

A big ol' for loop is no substitute for a nice little sleep statement.

-sauoq
"My two cents aren't worth a dime.";

Replies are listed 'Best First'.
Re: Re: Re: Re: Catching signals
by gri6507 (Deacon) on Sep 04, 2002 at 18:46 UTC
    well, as far as forking is concerned, if i remember by Unix systems course, each process gets a slice of the processor, so even though one is stuck in the for (;;) loop, the other process should still execute. So in that sense, here, a sleep = for ();
      if i remember by Unix systems course, each process gets a slice of the processor, so even though one is stuck in the for (;;) loop, the other process should still execute.

      A slice, in that sense, is a "time slice." Each process gets the cpu for a slice of time not for a single instruction or something. (Otherwise, there'd be a lot of overhead to no good purpose.)

      So in that sense, here, a sleep = for ();

      Not unless you can guarantee that the empty for loop won't complete before the child is able to complete setting its signal handler. The empty for loop is very quick. The sleep, on the other hand, actually blocks for a period of time. So, in no sense at all does a sleep equal a for loop.

      -sauoq
      "My two cents aren't worth a dime.";