note sundialsvc4 <p> Approach the problem this way: &nbsp; the event just means, &ldquo;you should not be asleep right now.&rdquo; &nbsp (Not &ldquo;please wake up.&rdquo;) &nbsp; The main-loop of the thread is driven by a set of shared flags which tell it what it should do next, one of the choices being &ldquo;die now.&rdquo; <code> while (1) { if (shared.die) { exit; } elsif (shared.do_this) { do_this; } elsif (shared.do_that) { do_that; } ... else { wait_for_event(); } } </code> <p> The parent thread <em>first</em> sets one of the flags, <em>then</em> strobes the event to be sure that the child is not-asleep to respond to it. </p><p> You don&rsquo;t need to invent these things from scratch. &nbsp; Look at existing workhorses such as [mod://POE]. </p> 1050766 1050766