pthread_yield
Section: C Library Functions (3)
Updated: 2026-02-08
Index
JM Home Page
roff page
名前
pthread_yield - プロセッサを明け渡す (yield)
ライブラリ
POSIX スレッドライブラリ (libpthread,~-lpthread)
書式
#define _GNU_SOURCE /* See feature_test_macros(7) */
#include <pthread.h>
[[deprecated]] int pthread_yield(void);
説明
Note: This function is deprecated; see below.
pthread_yield() を呼び出すと、呼び出したスレッドは CPU を手放す。
スレッドはそのスレッドの静的優先度の実行キューの末尾に回り、
別のスレッドが実行されるようにスケジューリングされる。
詳細は sched_yield(2) を参照。
返り値
成功すると、 pthread_yield() は 0 を返す。
エラーの場合、エラー番号を返す。
エラー
Linux では、この関数の呼び出しは常に成功する
(ただし、移植性や将来も動作することを保証したいアプリケーションでは
正のエラーの返り値を処理するようにすべきである)。
属性
この節で使用されている用語の説明については、 attributes(7) を参照。
| インターフェース | 属性 | 値
|
|
pthread_yield()
| Thread safety | MT-Safe
|
バージョン
Linux では、この関数は sched_yield(2) を呼び出す形で実装されている。
標準規格
なし。
歴史
Deprecated since glibc 2.34. Use the standardized sched_yield(2)
instead.
注意
pthread_yield() is intended for use with real-time scheduling policies
(i.e., SCHED_FIFO or SCHED_RR). Use of pthread_yield() with
nondeterministic scheduling policies such as SCHED_OTHER is unspecified
and very likely means your application design is broken.
関連項目
sched_yield(2), pthreads(7), sched(7)
Index
- 名前
-
- ライブラリ
-
- 書式
-
- 説明
-
- 返り値
-
- エラー
-
- 属性
-
- バージョン
-
- 標準規格
-
- 歴史
-
- 注意
-
- 関連項目
-
This document was created by
man2html,
using the manual pages.