.\" Copyright (C) Tom Bjorkholm & Markus Kuhn, 1996 .\" .\" %%%LICENSE_START(GPLv2+_DOC_FULL) .\" This is free documentation; you can redistribute it and/or .\" modify it under the terms of the GNU General Public License as .\" published by the Free Software Foundation; either version 2 of .\" the License, or (at your option) any later version. .\" .\" The GNU General Public License's references to "object code" .\" and "executables" are to be interpreted as the output of any .\" document formatting or typesetting system, including .\" intermediate and printed output. .\" .\" This manual is distributed in the hope that it will be useful, .\" but WITHOUT ANY WARRANTY; without even the implied warranty of .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the .\" GNU General Public License for more details. .\" .\" You should have received a copy of the GNU General Public .\" License along with this manual; if not, see .\" . .\" %%%LICENSE_END .\" .\" 1996-04-01 Tom Bjorkholm .\" First version written .\" 1996-04-10 Markus Kuhn .\" revision .\" .\"******************************************************************* .\" .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* .\" .\" Japanese Version Copyright (c) 1997 HANATAKA Shinya .\" all rights reserved. .\" Translated Sun Feb 23 22:42:36 JST 1997 .\" by HANATAKA Shinya .\" Updated 2008-11-10, Akihiro MOTOKI , LDP v3.13 .\" .TH SCHED_YIELD 2 2008\-10\-18 Linux "Linux Programmer's Manual" .SH 名前 sched_yield \- プロセッサーを空け渡す(yield) .SH 書式 \fB#include \fP .sp \fBint sched_yield(void);\fP .SH 説明 \fBsched_yield\fP() を呼び出すことで、呼び出したスレッドが CPU の使用権を手放すことができる。 そのスレッドは、そのスレッドの静的プライオリティのキューの末尾に 移動し、新しいスレッドが走り始める。 .SH 返り値 成功した場合は \fBsched_yield\fP() は 0 を返す。 エラーの場合は \-1 が返され、 \fIerrno\fP が適切に設定される。 .SH エラー Linux の実装では、 \fBsched_yield\fP() は常に成功する。 .SH 準拠 POSIX.1\-2001. .SH 注意 \fBsched_yield\fP() を呼び出した時点で最大優先度のリストの中に呼び出し元のスレッドしか 存在しなければ、そのスレッドは呼び出し後も走り続けることになる。 POSIX システムで \fBsched_yield\fP() は \fI\fP に \fB_POSIX_PRIORITY_SCHEDULING\fP が定義されている場合にのみ使用可能である。 \fBsched_yield\fP() を戦略的に呼び出すことで、(極度に) 競合するリソース (mutex など) を呼び出し元が解放した際に他のスレッドやプロセスに実行機会を与えることで、 性能を上げることができる。 \fBsched_yield\fP() を必要もないのに呼び出したり、不適切な場面 (例えば、他のスケジューリング 対象となるスレッドが必要とするリソースを呼び出し元が保持したままの状態) で呼び出したりするのは避けること。なぜなら、 \fBsched_yield\fP() の呼び出しより不必要なコンテキストスイッチが起こり、システム性能が 劣化する結果になるからである。 .SH 関連項目 Linux のスケージュリング (scheduling) については \fBsched_setscheduler\fP(2) を参照。 .PP \fIProgramming for the real world \- POSIX.4\fP by Bill O. Gallmeister, O'Reilly & Associates, Inc., ISBN 1\-56592\-074\-0. .SH この文書について この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.65 の一部 である。プロジェクトの説明とバグ報告に関する情報は http://www.kernel.org/doc/man\-pages/ に書かれている。