Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

thr_continue(3c) [opensolaris man page]

thr_suspend(3C) 					   Standard C Library Functions 					   thr_suspend(3C)

NAME
thr_suspend, thr_continue - suspend or continue thread execution SYNOPSIS
cc -mt [ flag... ] file...[ library... ] #include <thread.h> int thr_suspend(thread_t target_thread); int thr_continue(thread_t target_thread); DESCRIPTION
The thr_suspend() function immediately suspends the execution of the thread specified by target_thread. On successful return from thr_sus- pend(), the suspended thread is no longer executing. Once a thread is suspended, subsequent calls to thr_suspend() have no effect. The thr_continue() function resumes the execution of a suspended thread. Once a suspended thread is continued, subsequent calls to thr_con- tinue() have no effect. A suspended thread will not be awakened by any mechanism other than a call to thr_continue(). Signals and the effect of calls tomu- tex_unlock(3C), rw_unlock(3C), sema_post(3C), cond_signal(3C), and cond_broadcast(3C) remain pending until the execution of the thread is resumed by thr_continue(). RETURN VALUES
If successful, the thr_suspend() and thr_continue() functions return 0. Otherwise, a non-zero value is returned to indicate the error. ERRORS
The thr_suspend() and thr_continue() functions will fail if: ESRCH The target_thread cannot be found in the current process. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |MT-Level |MT-Safe | +-----------------------------+-----------------------------+ SEE ALSO
thr_create(3C), thr_join(3C), attributes(5), standards(5) WARNINGS
The thr_suspend() function is extremely difficult to use safely because it suspends the target thread with no concern for the target thread's state. The target thread could be holding locks, waiting for a lock, or waiting on a condition variable when it is unconditionally suspended. The thread will not run until thr_continue() is applied, regardless of any calls to mutex_unlock(), cond_signal(), or cond_broadcast() by other threads. Its existence on a sleep queue can interfere with the waking up of other threads that are on the same sleep queue. The thr_suspend() and thr_continue() functions should be avoided. Mechanisms that involve the cooperation of the targeted thread, such as mutex locks and condition variables, should be employed instead. SunOS 5.11 22 Mar 2002 thr_suspend(3C)

Check Out this Related Man Page

thr_getprio(3C) 					   Standard C Library Functions 					   thr_getprio(3C)

NAME
thr_getprio, thr_setprio - access dynamic thread scheduling SYNOPSIS
cc -mt [ flag... ] file...[ library... ] #include <thread.h> int thr_setprio(thread_t target_thread, int priority); int thr_getprio(thread_t target_thread, int *priority); DESCRIPTION
The thr_setprio() function dynamically changes the priority of the thread specified by target_thread within the current process to the pri- ority specified by priority. By default, threads contend for synchronization objects based on fixed priorities that range from 0, the least significant, to 127. The target_thread will receive precedence by libthread over lower priority threads with respect to synchro- nization object contention. The thr_getprio() function stores the current priority for the thread specified by target_thread in the location pointed to by priority. Thread priorities regulate the order in which threads unblock from synchronization objects and are different from realtime priorities, which regulate and enforce access to CPU resources. Programs that need access to "real" priorities should use bound threads in the realtime class (see priocntl(2)). RETURN VALUES
If successful, the thr_getprio() and thr_setprio() return 0. Otherwise, an error number is returned to indicate the error. ERRORS
For each of the following conditions, these functions return an error number if the condition is detected. ESRCH The value specified by target_thread does not refer to an existing thread. The thr_getprio() and thr_setprio() functions may fail if: EINVAL The value of priority makes no sense for the scheduling class associated with the target_thread. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |MT-Level |MT-Safe | +-----------------------------+-----------------------------+ SEE ALSO
priocntl(2), sched_setparam(3RT), thr_create(3C), thr_suspend(3C), thr_yield(3C), attributes(5), standards(5) SunOS 5.10 22 Mar 2001 thr_getprio(3C)
Man Page