< Previous PageNext Page > Hide TOC

Deprecated Thread Manager Functions

A function identified as deprecated has been superseded and may become unsupported in the future.

Deprecated in Mac OS X v10.3

GetFreeThreadCount

Determines how many threads are available to be allocated in a thread pool. (Deprecated in Mac OS X v10.3. There is no replacement.)

OSErr GetFreeThreadCount (
   ThreadStyle threadStyle,
   SInt16 *freeCount
);

Parameters
threadStyle

The type of thread to get information about. Cooperative is the only type that you can specify. Historically, the Thread Manger supported two types of threads, preemptive and cooperative, but the Thread Manager no longer supports preemptive threads.

freeCount

On return, a pointer to the number of threads available to be allocated.

Return Value

A result code. See “Thread Manager Result Codes.”

Discussion

The number of threads in the pool varies throughout execution of your application. Calls to CreateThreadPool add threads to the pool and calls to the function NewThread , when an existing thread is allocated, reduce the number of threads. You also add threads to the pool when you dispose of a thread with the DisposeThread function and specify that the thread be recycled.

Use the GetSpecificFreeThreadCount function to determine how many threads of a particular stack size are available.

Special Considerations

Active development with the Thread Manager is not recommended. The API is intended only for developers who are porting their applications to Mac OS X and whose code relies on the cooperative threading model. If you are writing a new Carbon application, you should use POSIX threads or the Multiprocessing Services API instead. See Threading Programming Guide for more information.

Availability
Declared In
Threads.h

GetSpecificFreeThreadCount

Determines how many threads with a stack size equal to or greater than the specified size are available to be allocated in a thread pool. (Deprecated in Mac OS X v10.3. There is no replacement.)

OSErr GetSpecificFreeThreadCount (
   ThreadStyle threadStyle,
   Size stackSize,
   SInt16 *freeCount
);

Parameters
threadStyle

The type of thread to get information about. Cooperative is the only type that you can specify. Historically, the Thread Manger supported two types of threads, preemptive and cooperative, but the Thread Manager no longer supports preemptive threads.

stackSize

The stack size of the threads to get information about.

freeCount

On return, a pointer to the number of threads of the specified stack size available to be allocated.

Return Value

A result code. See “Thread Manager Result Codes.”

Discussion

The GetSpecificFreeThreadCount function determines how many threads with a stack size equal to or greater than the specified size are available to be allocated. Use this function instead of GetFreeThreadCount when you are interested not simply in the total number of available threads but when you want to know the number of available threads of a specified stack size as well.

The number of threads in the pool varies throughout execution of your application. Calls to the function CreateThreadPool add threads to the pool and calls to the function NewThread , when an existing thread is allocated, reduce the number of threads. You also add threads to the pool when you dispose of a thread with the DisposeThread function and specify that the thread be recycled.

To determine how many threads of any stack size are available, use the GetFreeThreadCount function.

Special Considerations

Active development with the Thread Manager is not recommended. The API is intended only for developers who are porting their applications to Mac OS X and whose code relies on the cooperative threading model. If you are writing a new Carbon application, you should use POSIX threads or the Multiprocessing Services API instead. See Threading Programming Guide for more information.

Availability
Declared In
Threads.h

< Previous PageNext Page > Hide TOC


© 2007 Apple Inc. All Rights Reserved. (Last updated: 2007-04-04)


Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.