[ Previous |
Next |
Contents |
Glossary |
Home |
Search ]
AIX Version 4.3 General Programming Concepts: Writing and Debugging Programs
Threads Library Quick Reference
This section provides a summary of the threads library:
Supported Interfaces
On AIX systems, _POSIX_THREADS, _POSIX_THREAD_ATTR_STACKADDR, _POSIX_THREAD_ATTR_STACKSIZE and _POSIX_THREAD_PROCESS_SHARED are
always defined. Therefore, the following threads interfaces are
supported:
POSIX Interfaces
pthread_atfork |
pthread_attr_destroy |
pthread_attr_getdetachstate |
pthread_attr_getschedparam |
pthread_attr_getstackaddr |
pthread_attr_getstacksize |
pthread_attr_init |
pthread_attr_setdetachstate |
pthread_attr_setschedparam |
pthread_attr_setstackaddr |
pthread_attr_setstacksize |
pthread_cancel |
pthread_cleanup_pop |
pthread_cleanup_push |
pthread_detach |
pthread_equal |
pthread_exit |
pthread_getspecific |
pthread_join |
pthread_key_create |
pthread_key_delete |
pthread_kill |
pthread_mutex_destroy |
pthread_mutex_init |
pthread_mutex_lock |
pthread_mutex_trylock |
pthread_mutex_unlock |
pthread_mutexattr_destroy |
pthread_mutexattr_getpshared |
pthread_mutexattr_init |
pthread_mutexattr_setpshared |
pthread_once |
pthread_self |
pthread_setcancelstate |
pthread_setcanceltype |
pthread_setspecific |
pthread_sigmask |
pthread_testcancel |
sigwait |
pthread_cond_broadcast |
pthread_cond_destroy |
pthread_cond_init |
pthread_cond_signal |
pthread_cond_timedwait |
pthread_cond_wait |
pthread_condattr_destroy |
pthread_condattr_getpshared |
pthread_condattr_init |
pthread_condattr_setpshared |
pthread_create |
Single Unix Specification Interfaces
pthread_attr_getguardsize |
pthread_attr_setguardsize |
pthread_getconcurrency |
pthread_mutexattr_gettype |
pthread_mutexattr_settype |
pthread_rwlock_destroy |
pthread_rwlock_init |
pthread_rwlock_rdlock |
pthread_rwlock_tryrdlock |
pthread_rwlock_trywrlock |
pthread_rwlock_unlock |
pthread_rwlock_wrlock |
pthread_rwlockattr_destroy |
pthread_rwlockattr_getpshared |
pthread_rwlockattr_init |
pthread_rwlockattr_setpshared |
pthread_setconcurrency |
|
|
On AIX systems, _POSIX_THREAD_SAFE_FUNCTIONS is always defined.
Therefore, the following interfaces are always supported:
asctime_r |
ctime_r |
flockfile |
ftrylockfile |
funlockfile |
getc_unlocked |
getchar_unlocked |
getgrgid_r |
getgrnam_r |
getpwnam_r |
getpwuid_r |
gmtime_r |
localtime_r |
putc_unlocked |
putchar_unlocked |
rand_r |
readdir_r |
strtok_r |
AIX does not support the following interfaces; the symbols are provided
but they always return an error and set the errno to ENOSYS:
pthread_attr_getinheritsched |
pthread_attr_getschedpolicy |
pthread_attr_getscope |
pthread_attr_setinheritsched |
pthread_attr_setschedpolicy |
pthread_attr_setscope |
pthread_getschedparam |
pthread_mutex_getprioceiling |
pthread_mutex_setprioceiling |
pthread_mutexattr_getprioceiling |
pthread_mutexattr_getprotocol |
pthread_mutexattr_setprioceiling |
pthread_mutexattr_setprotocol |
pthread_setschedparam |
Thread-safety
The following AIX interfaces are not thread-safe:
asctime |
ctime |
getc_unlocked |
getchar_unlocked |
getgrgid |
getgrnam |
getlogin |
getopt |
getpwnam |
getpwuid |
gmtime |
localtime |
putc_unlocked |
putchar_unlocked |
rand |
readdir |
strtok |
ttyname |
basename |
catgets |
dbm_clearerr |
dbm_close |
dbm_delete |
dbm_error |
dbm_fetch |
dbm_firstkey |
dbm_nextkey |
dbm_open |
dbm_store |
dirname |
drand48 |
ecvt |
encrypt |
endgrent |
endpwent |
endutxent |
fcvt |
gamma |
gcvt |
getdate |
getenv |
getgrent |
getpwent |
getutxent |
getutxid |
getutxline |
getw |
l64a |
lgamma |
lrand48 |
mrand48 |
nl_langinfo |
ptsname |
putenv |
pututxline |
setgrent |
setkey |
setpwent |
setutxent |
strerror |
|
|
The interfaces ctermid and tmpnam are not thread-safe if passed a NULL argument.
Note that certain subroutines may be implemented as macros on some systems. You should avoid using the address of threads subroutines.
Data Types
The following data types are defined for the threads library in the pthread.h header file.
pthread_t |
Identifies a thread. |
pthread_attr_t |
Identifies a thread attributes object. |
pthread_cond_t |
Identifies a condition variable. |
pthread_condattr_t |
Identifies a condition attributes object. |
pthread_key_t |
Identifies a thread-speciic data key. |
pthread_mutex_t |
Identifies a mutex. |
pthread_mutexattr_t |
Identifies a mutex attributes object. |
pthread_once_t |
Identifies a one time initialization object. |
The definition of these data types may vary from one system to another.
Limits and Default Values
The threads library has some implementation-dependent limits and default values. These limits and default values can be retrieved by symbolic constants to enhance the portability of programs.
Maximum Number of Threads per Process
The maximum number of threads per process is 512. The maximum number of threads can be retrieved at compilation time using the PTHREAD_THREADS_MAX symbolic constant defined in the pthread.h header file.
Minimum Stack Size
The minimum stack size for a thread is 96KB. It is also the default stack size. This number can be retrieved at compilation time using the PTHREAD_STACK_MIN symbolic constant defined in the pthread.h header file.
Note that the maximum stack size is 256MB, the size of a segment. This limit is indicated by the PTHREAD_STACK_MAX symbolic constant in the pthread.h header file.
Maximum Number of Thread-Specific Data Keys
The number of thread-specific data keys is limited to 508. This number can be retrieved at compilation time using the PTHREAD_KEYS_MAX symbolic constant defined in the pthread.h header file.
Default Attribute Values
The default values for the thread attributes
object are defined in the pthread.h header file by the following symbolic
constants:
DEFAULT_DETACHSTATE |
PTHREAD_CREATE_DETACHED. Specifies the default value for the detachstate attribute. |
DEFAULT_INHERIT |
PTHREAD_INHERIT_SCHED. Specifies the default value for the inheritsched attribute. |
DEFAULT_PRIO |
1 (one). Specifies the default value for the sched_prio
field of the schedparam attribute. |
DEFAULT_SCHED |
SCHED_OTHER. Specifies the default value for the schedpolicy attribute of a thread attributes object. |
DEFAULT_SCOPE |
PTHREAD_SCOPE_LOCAL. Specifies the default value for the contention-scope attribute. |
The actual values shown may vary from one release to another.
Related Information
Threads Programming Overview.
Threads Library Options.
[ Previous |
Next |
Contents |
Glossary |
Home |
Search ]