Thread: how can I achive when, do?

  1. #1
    Registered User
    Join Date
    Jan 2009

    how can I achive: when, do?

    What different ways are available to achive an action, when a specific event has occured besides a callback or making a loop that does nothing but wait for a condition to become true?

    I have read up a bit on signals in unix, would it be possibel to make a function pause until it recieves a signal from another function?

    I have used the "waiting in a loop" for now but it wastes a lot of cpu resources.
    Last edited by Subsonics; 03-20-2009 at 07:31 AM.

  2. #2
    Join Date
    Oct 2008
    i dont quite understand what your requirement is...but if its multiprocessing feature you are looking for then...

    if you want to make a function wait for another function then...

    for threads
    Last edited by creeping death; 03-20-2009 at 07:53 AM.

  3. #3
    Registered User
    Join Date
    Jan 2009
    Thank you, as far as I can tell pause could work it seems. What I have is a loop that sends packets from a packet array to a network, but the condition is that a packet canīt be sent until an o.k flag has been recieved.

    The input is handled by a callback in another thread that polls the input. If I can get my loop to pause after each packet until it recieves a signal that the packet arrived successfully that would be great.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How can we achive this?
    By ssharish2005 in forum C Programming
    Replies: 5
    Last Post: 09-19-2007, 11:46 AM
  2. God
    By datainjector in forum A Brief History of
    Replies: 746
    Last Post: 12-22-2002, 12:01 PM