• 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
OS notifier preemption guarantees
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

OS notifier preemption guarantees


  • Subject: OS notifier preemption guarantees
  • From: Miro Jurisic <email@hidden>
  • Date: Wed, 28 Apr 2004 16:11:35 -0400

I am installing a notifier proc on an OT endpoint, and I observed that the notifier fires on a separate preemptive thread (which I expected).

I also observed a case in which the notifier is preempted and control is returned to the main thread before the notifier completes, which I did not expect; I expected the notifier to be atomic as far as the main thread is concerned, and the fact that it isn't causes interesting problems in my code: is sets up a race condition where while the notifier is active the main thread sometimes closes the endpoint and deletes the C++ object that's associated with the endpoint, causing the notifier to crash when it gets time later.

How should I deal with this? The best I can come up with is:

main thread:

acquire lock
close the provider
dispose the C++ object
release lock

notifier:

acquire lock
if provider hasn't been closed then
do stuff
release lock

which is fine except that I don't know how to write the "if provider hasn't been closed"part.

meeroh
--

<http://web.meeroh.org/> | KB1FMP

"And when I have understanding of computers, I shall be
the supreme being!" -- Evil, "Time Bandits"
_______________________________________________
macnetworkprog mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/macnetworkprog
Do not post admin requests to the list. They will be ignored.


  • Follow-Ups:
    • Re: OS notifier preemption guarantees
      • From: Doug Hill <email@hidden>
  • Prev by Date: Re: quantity in send queue ?
  • Next by Date: Re: throttling suggestions ? (and quantity in send queue)
  • Previous by thread: Re: Replacing AppleTalk code?
  • Next by thread: Re: OS notifier preemption guarantees
  • Index(es):
    • Date
    • Thread