HP-UX Reference (11i v2 07/12) - 3 Library Functions N-Z (vol 7)

p
pthread_resume_np(3T) pthread_resume_np(3T)
(Pthread Library)
[ESRCH] The target thread thread is not in the current process.
[EDEADLK] The target thread thread is the last running thread in the process. The operation
would result in deadlock for the process.
If any of the following occur, the
pthread_continue()
and pthread_resume_np()
functions
return the corresponding error number.
[ESRCH] The target thread thread is not in the current process.
[EINVAL] The value specified by flags is invalid.
APPLICATION USAGE
This functionality enables a process that is multithreaded to temporarily suspend all activity to a single
thread of control. When the process is single threaded, the address space is not changing, and a consistent
view of the process can be gathered. One example of its use is for garbage collecting. The garbage collector
runs asynchronously within the process and assumes that the process is not changing while it is running.
Suspending a thread may have adverse effects on an application. If a thread is suspended while it holds a
critical resource, such as a mutex or a read-write lock, the application may stop or even deadlock until the
thread is continued. While the thread is suspended, other threads which may contend for the same
resource must block until the thread is continued. Depending on application behavior, this may even result
in deadlock. Application programmers are advised to either a) only suspend threads which call async-signal
safe functions or b) ensure that the suspending thread does not contend for the same resources that the
suspended thread may have acquired. Note: this includes resources that may be acquired by libraries.
The
pthread_suspend()
, pthread_continue(), and pthread_resume_np()
functions can-
not reliably be used for thread synchronization. Synchronization primitives like mutexes, semaphores,
read-write locks, and condition variables should be used instead.
AUTHOR
pthread_suspend()
and pthread_continue() were developed by X/Open.
pthread_resume_np()
was developed by HP.
SEE ALSO
pthread_create(3T).
STANDARDS CONFORMANCE
pthread_continue()
: None.
pthread_resume_np()
: None.
pthread_suspend()
: None.
256 Hewlett-Packard Company 2 HP-UX 11i Version 2: December 2007 Update