• 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
Re: how many threads/tasks are running in my application
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: how many threads/tasks are running in my application


  • Subject: Re: how many threads/tasks are running in my application
  • From: Shawn Erickson <email@hidden>
  • Date: Sat, 10 Jan 2004 09:06:17 -0800

On Jan 10, 2004, at 2:09 AM, Ramakrishna Kondapalli wrote:

Hi,

I am working in an cocoa application which is multithreaded. My
requirement is that if some other task/thread is running in the
application, then I should not be able to quit the application. Is there
any straight forward way of knowing at an instant, how many
threads/tasks are running in my application. I tried Cocoa
documentation, it does have a notification -
NSDidBecomeSingleThreadedNotification, which i think can be useful. But
the documentation says, it is not implemented.

Is there any other way to determine this?

Note that in support of dynamic GUI elements (like spinners, default buttons, etc.) you will get secondary threads created by the framework in your application. These threads generally stay around, sleeping when needed, for the life of the application once created. Also things like APE, etc. can create secondary threads in your application.

So using the count of current threads in your application to block quit requests can be a bad idea. It is better to globally track pending or in process work items. Countless possible solutions exist for this but it is hard to suggest any without having an idea of what you application may be doing and how it manages such work.

I have a 2/3 finished thread pool with the concept of work units and ability to queue work and spread it out across a fixed or grow-able pool of threads. This type of construct can be used to quickly understand queued or in progress work units.

I may finish it some day and make it available to folks... (sleep always gets in the way however)

-Shawn
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: how many threads/tasks are running in my application
      • From: Shawn Erickson <email@hidden>
References: 
 >how many threads/tasks are running in my application (From: "Ramakrishna Kondapalli" <email@hidden>)

  • Prev by Date: Re: vImage
  • Next by Date: Any word on GarageBand plug-ins
  • Previous by thread: Re: how many threads/tasks are running in my application
  • Next by thread: Re: how many threads/tasks are running in my application
  • Index(es):
    • Date
    • Thread