On 9/12/2011 9:48 AM, Mark Murphy/STAR BASE Consulting Inc. wrote:
Of course the OP doesn't say whether the jobs must complete successfully, or just be finished running. The add 1 subtract 1 method does not work if you are just waiting for all the jobs to be gone. Say something ends abnormally, the data area will never get back to zero.


The two easiest options are the plus one/minus one data area (for when the jobs must end successfully) and the lock on the data area for when you only care when the jobs end. Alan didn't happen to mention what to do when one of the 17 jobs fails, so I'm still not 100% certain what he wants to do.

A combination of the two is actually pretty slick. You wait until all the jobs finish via the exclusive lock, and then check the data area. If it's zero, all jobs finished successfully. If not, then at least one job failed (in fact, the number in the data area tells you how many failed). Simple!

Joe

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.