• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Interrupting sleep call
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Interrupting sleep call


  • Subject: Interrupting sleep call
  • From: Tim McLaren <email@hidden>
  • Date: Thu, 6 Dec 2001 19:46:02 +1100

I wonder if anyone can help me with a problem I am having. I am writing some code which is multi-threaded which one of the threads performs a sleep within a loop while waiting for some data from the other thread to process. The idea of using the sleep is to stop it from free wheeling and using unnecessary cpu cycles.

What I am trying to do is to be able to wake up the sleeping thread before the sleep has completed by sending a signal to the program from another thread.

According to the man page for sleep this should work which it did when I wrote a simple c program to test it. Unfortunately, when called from a cocoa app the sleep does not exit prematurely, even though the signal is caught by the signal handler.

Does anybody know of a way to make this work within a cocoa app.

Thanks
Tim.

--


  • Follow-Ups:
    • Re: Interrupting sleep call
      • From: Raphael Sebbe <email@hidden>
  • Prev by Date: Re: [ANN] Mac OS X Metadata Petition
  • Next by Date: The sick power!
  • Previous by thread: Re: editing NSCell attributes inside NSOutlineView
  • Next by thread: Re: Interrupting sleep call
  • Index(es):
    • Date
    • Thread