# SOME DESCRIPTIVE TITLE # Copyright (C) YEAR Free Software Foundation, Inc. # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR , YEAR. # msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "POT-Creation-Date: 2012-04-25 05:36+0900\n" "PO-Revision-Date: 2012-04-27 05:17+0900\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #. type: TH #: build/C/man2/getcontext.2:23 #, no-wrap msgid "GETCONTEXT" msgstr "GETCONTEXT" #. type: TH #: build/C/man2/getcontext.2:23 #, no-wrap msgid "2009-03-15" msgstr "2009-03-15" #. type: TH #: build/C/man2/getcontext.2:23 build/C/man3/pthread_attr_init.3:24 #: build/C/man3/pthread_attr_setaffinity_np.3:24 #: build/C/man3/pthread_attr_setdetachstate.3:24 #: build/C/man3/pthread_attr_setguardsize.3:24 #: build/C/man3/pthread_attr_setinheritsched.3:24 #: build/C/man3/pthread_attr_setschedparam.3:24 #: build/C/man3/pthread_attr_setschedpolicy.3:24 #: build/C/man3/pthread_attr_setscope.3:24 #: build/C/man3/pthread_attr_setstack.3:24 #: build/C/man3/pthread_attr_setstackaddr.3:24 #: build/C/man3/pthread_attr_setstacksize.3:24 #: build/C/man3/pthread_cancel.3:24 build/C/man3/pthread_cleanup_push.3:24 #: build/C/man3/pthread_cleanup_push_defer_np.3:24 #: build/C/man3/pthread_create.3:24 build/C/man3/pthread_detach.3:24 #: build/C/man3/pthread_equal.3:24 build/C/man3/pthread_exit.3:24 #: build/C/man3/pthread_getattr_np.3:24 #: build/C/man3/pthread_getcpuclockid.3:24 build/C/man3/pthread_join.3:24 #: build/C/man3/pthread_kill.3:24 #: build/C/man3/pthread_kill_other_threads_np.3:24 #: build/C/man3/pthread_self.3:24 build/C/man3/pthread_setaffinity_np.3:24 #: build/C/man3/pthread_setcancelstate.3:24 #: build/C/man3/pthread_setconcurrency.3:23 #: build/C/man3/pthread_setschedparam.3:24 #: build/C/man3/pthread_setschedprio.3:24 build/C/man3/pthread_sigmask.3:24 #: build/C/man3/pthread_sigqueue.3:23 build/C/man3/pthread_testcancel.3:24 #: build/C/man3/pthread_tryjoin_np.3:24 build/C/man3/pthread_yield.3:23 #: build/C/man7/pthreads.7:24 #, no-wrap msgid "Linux" msgstr "Linux" #. type: TH #: build/C/man2/getcontext.2:23 build/C/man3/makecontext.3:25 #: build/C/man3/pthread_attr_init.3:24 #: build/C/man3/pthread_attr_setaffinity_np.3:24 #: build/C/man3/pthread_attr_setdetachstate.3:24 #: build/C/man3/pthread_attr_setguardsize.3:24 #: build/C/man3/pthread_attr_setinheritsched.3:24 #: build/C/man3/pthread_attr_setschedparam.3:24 #: build/C/man3/pthread_attr_setschedpolicy.3:24 #: build/C/man3/pthread_attr_setscope.3:24 #: build/C/man3/pthread_attr_setstack.3:24 #: build/C/man3/pthread_attr_setstackaddr.3:24 #: build/C/man3/pthread_attr_setstacksize.3:24 #: build/C/man3/pthread_cancel.3:24 build/C/man3/pthread_cleanup_push.3:24 #: build/C/man3/pthread_cleanup_push_defer_np.3:24 #: build/C/man3/pthread_create.3:24 build/C/man3/pthread_detach.3:24 #: build/C/man3/pthread_equal.3:24 build/C/man3/pthread_exit.3:24 #: build/C/man3/pthread_getattr_np.3:24 #: build/C/man3/pthread_getcpuclockid.3:24 build/C/man3/pthread_join.3:24 #: build/C/man3/pthread_kill.3:24 #: build/C/man3/pthread_kill_other_threads_np.3:24 #: build/C/man3/pthread_self.3:24 build/C/man3/pthread_setaffinity_np.3:24 #: build/C/man3/pthread_setcancelstate.3:24 #: build/C/man3/pthread_setconcurrency.3:23 #: build/C/man3/pthread_setschedparam.3:24 #: build/C/man3/pthread_setschedprio.3:24 build/C/man3/pthread_sigmask.3:24 #: build/C/man3/pthread_sigqueue.3:23 build/C/man3/pthread_testcancel.3:24 #: build/C/man3/pthread_tryjoin_np.3:24 build/C/man3/pthread_yield.3:23 #: build/C/man7/pthreads.7:24 #, no-wrap msgid "Linux Programmer's Manual" msgstr "Linux Programmer's Manual" #. type: SH #: build/C/man2/getcontext.2:24 build/C/man3/makecontext.3:26 #: build/C/man3/pthread_attr_init.3:25 #: build/C/man3/pthread_attr_setaffinity_np.3:25 #: build/C/man3/pthread_attr_setdetachstate.3:25 #: build/C/man3/pthread_attr_setguardsize.3:25 #: build/C/man3/pthread_attr_setinheritsched.3:25 #: build/C/man3/pthread_attr_setschedparam.3:25 #: build/C/man3/pthread_attr_setschedpolicy.3:25 #: build/C/man3/pthread_attr_setscope.3:25 #: build/C/man3/pthread_attr_setstack.3:25 #: build/C/man3/pthread_attr_setstackaddr.3:25 #: build/C/man3/pthread_attr_setstacksize.3:25 #: build/C/man3/pthread_cancel.3:25 build/C/man3/pthread_cleanup_push.3:25 #: build/C/man3/pthread_cleanup_push_defer_np.3:25 #: build/C/man3/pthread_create.3:25 build/C/man3/pthread_detach.3:25 #: build/C/man3/pthread_equal.3:25 build/C/man3/pthread_exit.3:25 #: build/C/man3/pthread_getattr_np.3:25 #: build/C/man3/pthread_getcpuclockid.3:25 build/C/man3/pthread_join.3:25 #: build/C/man3/pthread_kill.3:25 #: build/C/man3/pthread_kill_other_threads_np.3:25 #: build/C/man3/pthread_self.3:25 build/C/man3/pthread_setaffinity_np.3:25 #: build/C/man3/pthread_setcancelstate.3:25 #: build/C/man3/pthread_setconcurrency.3:24 #: build/C/man3/pthread_setschedparam.3:25 #: build/C/man3/pthread_setschedprio.3:25 build/C/man3/pthread_sigmask.3:25 #: build/C/man3/pthread_sigqueue.3:24 build/C/man3/pthread_testcancel.3:25 #: build/C/man3/pthread_tryjoin_np.3:25 build/C/man3/pthread_yield.3:24 #: build/C/man7/pthreads.7:25 #, no-wrap msgid "NAME" msgstr "名前" #. type: Plain text #: build/C/man2/getcontext.2:26 msgid "getcontext, setcontext - get or set the user context" msgstr "getcontext, setcontext - ユーザコンテキストを取得/設定する" #. type: SH #: build/C/man2/getcontext.2:26 build/C/man3/makecontext.3:28 #: build/C/man3/pthread_attr_init.3:28 #: build/C/man3/pthread_attr_setaffinity_np.3:28 #: build/C/man3/pthread_attr_setdetachstate.3:28 #: build/C/man3/pthread_attr_setguardsize.3:28 #: build/C/man3/pthread_attr_setinheritsched.3:28 #: build/C/man3/pthread_attr_setschedparam.3:28 #: build/C/man3/pthread_attr_setschedpolicy.3:28 #: build/C/man3/pthread_attr_setscope.3:28 #: build/C/man3/pthread_attr_setstack.3:28 #: build/C/man3/pthread_attr_setstackaddr.3:28 #: build/C/man3/pthread_attr_setstacksize.3:28 #: build/C/man3/pthread_cancel.3:27 build/C/man3/pthread_cleanup_push.3:28 #: build/C/man3/pthread_cleanup_push_defer_np.3:28 #: build/C/man3/pthread_create.3:27 build/C/man3/pthread_detach.3:27 #: build/C/man3/pthread_equal.3:27 build/C/man3/pthread_exit.3:27 #: build/C/man3/pthread_getattr_np.3:27 #: build/C/man3/pthread_getcpuclockid.3:27 build/C/man3/pthread_join.3:27 #: build/C/man3/pthread_kill.3:27 #: build/C/man3/pthread_kill_other_threads_np.3:27 #: build/C/man3/pthread_self.3:27 build/C/man3/pthread_setaffinity_np.3:28 #: build/C/man3/pthread_setcancelstate.3:28 #: build/C/man3/pthread_setconcurrency.3:27 #: build/C/man3/pthread_setschedparam.3:28 #: build/C/man3/pthread_setschedprio.3:27 build/C/man3/pthread_sigmask.3:27 #: build/C/man3/pthread_sigqueue.3:26 build/C/man3/pthread_testcancel.3:27 #: build/C/man3/pthread_tryjoin_np.3:28 build/C/man3/pthread_yield.3:26 #, no-wrap msgid "SYNOPSIS" msgstr "書式" #. type: Plain text #: build/C/man2/getcontext.2:28 build/C/man3/makecontext.3:30 msgid "B<#include Eucontext.hE>" msgstr "B<#include Eucontext.hE>" #. type: Plain text #: build/C/man2/getcontext.2:30 msgid "BIB<);>" msgstr "BIB<);>" #. type: Plain text #: build/C/man2/getcontext.2:32 msgid "BIB<);>" msgstr "BIB<);>" #. type: SH #: build/C/man2/getcontext.2:32 build/C/man3/makecontext.3:35 #: build/C/man3/pthread_attr_init.3:37 #: build/C/man3/pthread_attr_setaffinity_np.3:40 #: build/C/man3/pthread_attr_setdetachstate.3:39 #: build/C/man3/pthread_attr_setguardsize.3:39 #: build/C/man3/pthread_attr_setinheritsched.3:39 #: build/C/man3/pthread_attr_setschedparam.3:39 #: build/C/man3/pthread_attr_setschedpolicy.3:39 #: build/C/man3/pthread_attr_setscope.3:39 #: build/C/man3/pthread_attr_setstack.3:52 #: build/C/man3/pthread_attr_setstackaddr.3:39 #: build/C/man3/pthread_attr_setstacksize.3:39 #: build/C/man3/pthread_cancel.3:35 build/C/man3/pthread_cleanup_push.3:38 #: build/C/man3/pthread_cleanup_push_defer_np.3:38 #: build/C/man3/pthread_create.3:36 build/C/man3/pthread_detach.3:35 #: build/C/man3/pthread_equal.3:35 build/C/man3/pthread_exit.3:35 #: build/C/man3/pthread_getattr_np.3:36 #: build/C/man3/pthread_getcpuclockid.3:36 build/C/man3/pthread_join.3:35 #: build/C/man3/pthread_kill.3:35 #: build/C/man3/pthread_kill_other_threads_np.3:33 #: build/C/man3/pthread_self.3:35 build/C/man3/pthread_setaffinity_np.3:40 #: build/C/man3/pthread_setcancelstate.3:37 #: build/C/man3/pthread_setconcurrency.3:36 #: build/C/man3/pthread_setschedparam.3:39 #: build/C/man3/pthread_setschedprio.3:35 build/C/man3/pthread_sigmask.3:36 #: build/C/man3/pthread_sigqueue.3:43 build/C/man3/pthread_testcancel.3:35 #: build/C/man3/pthread_tryjoin_np.3:40 build/C/man3/pthread_yield.3:34 #: build/C/man7/pthreads.7:27 #, no-wrap msgid "DESCRIPTION" msgstr "説明" #. type: Plain text #: build/C/man2/getcontext.2:44 msgid "" "In a System V-like environment, one has the two types I and " "I defined in Iucontext.hE> and the four functions " "B(), B(), B(3) and B(3) " "that allow user-level context switching between multiple threads of control " "within a process." msgstr "" "System V 的な環境では、 I および I という 2 つの型" "と、 B(), B(), B(3), B(3) " "という 4 つの関数が Iucontext.hE> で定義されており、あるプロセス内" "部で制御下にある複数のスレッド間で、 ユーザレベルのコンテキスト切替えができる" "ようになっている。" #. type: Plain text #: build/C/man2/getcontext.2:48 msgid "" "The I type is machine-dependent and opaque. The I " "type is a structure that has at least the following fields:" msgstr "" "I 型はマシン依存で、外部からは隠蔽されている。 I 型は" "構造体で、少なくとも以下の 4 つのフィールドを持つ。" #. type: Plain text #: build/C/man2/getcontext.2:58 #, no-wrap msgid "" "typedef struct ucontext {\n" " struct ucontext *uc_link;\n" " sigset_t uc_sigmask;\n" " stack_t uc_stack;\n" " mcontext_t uc_mcontext;\n" " ...\n" "} ucontext_t;\n" msgstr "" "typedef struct ucontext {\n" " struct ucontext *uc_link;\n" " sigset_t uc_sigmask;\n" " stack_t uc_stack;\n" " mcontext_t uc_mcontext;\n" " ...\n" "} ucontext_t;\n" #. type: Plain text #: build/C/man2/getcontext.2:75 msgid "" "with I and I defined in Isignal.hE>. Here " "I points to the context that will be resumed when the current " "context terminates (in case the current context was created using " "B(3)), I is the set of signals blocked in this " "context (see B(2)), I is the stack used by this " "context (see B(2)), and I is the machine-specific " "representation of the saved context, that includes the calling thread's " "machine registers." msgstr "" "I と I は Isignal.hE> で定義されている。 ここで " "I は、 現在のコンテキストが終了したとき、 続いて切り替わるコンテキス" "トへのポインタである (現在のコンテキストが B(3) で生成されたも" "のの場合)。 I はこのコンテキストでブロックされている シグナル群で" "ある (B(2) を見よ)。 I はこのコンテキストが用いている" "スタックである (B(2) を見よ)。 I は保存されている" "コンテキストの マシン特有の表現形式であり、 ここには呼び出したスレッドのマシ" "ンレジスタが格納される。" #. type: Plain text #: build/C/man2/getcontext.2:80 msgid "" "The function B() initializes the structure pointed at by I " "to the currently active context." msgstr "" "B() 関数は、 ポインタ I が指す構造体を、 現在アクティブなコ" "ンテキストに初期化する。" #. type: Plain text #: build/C/man2/getcontext.2:92 msgid "" "The function B() restores the user context pointed at by " "I. A successful call does not return. The context should have been " "obtained by a call of B(), or B(3), or passed as " "third argument to a signal handler." msgstr "" "B() 関数は、ポインタ I が指すユーザコンテキストをリストアす" "る。 呼び出しに成功すると返らない。 このコンテキストは、以前に B" "() または B(3) で得られたものか、 あるいはシグナルの第三引数と" "して与えられたものになる。" #. type: Plain text #: build/C/man2/getcontext.2:96 msgid "" "If the context was obtained by a call of B(), program execution " "continues as if this call just returned." msgstr "" "コンテキストが B() の呼び出しによって得られていたものの場合は、 " "プログラムはこの呼び出しから返った直後からのように実行を継続する。" #. type: Plain text #: build/C/man2/getcontext.2:107 msgid "" "If the context was obtained by a call of B(3), program " "execution continues by a call to the function I specified as the " "second argument of that call to B(3). When the function " "I returns, we continue with the I member of the structure " "I specified as the first argument of that call to B(3). " "When this member is NULL, the thread exits." msgstr "" "コンテキストが B(3) の呼び出しによって得られていたものの場合" "は、 プログラムの実行はその B(3) 呼び出しの第二引数で指定された" "関数 I を呼び出すかたちで継続する。 I から返ると、 B" "(3) 呼び出しの第一引数で指定されていた I 構造体の I メンバで継" "続する。 このメンバが NULL だった場合は、そのスレッドは終了する。" #. type: Plain text #: build/C/man2/getcontext.2:114 msgid "" "If the context was obtained by a call to a signal handler, then old standard " "text says that \"program execution continues with the program instruction " "following the instruction interrupted by the signal\". However, this " "sentence was removed in SUSv2, and the present verdict is \"the result is " "unspecified\"." msgstr "" "コンテキストがシグナルハンドラの呼び出しによって得られていたものの場合は、 古" "い標準によれば 「プログラムの実行はシグナルによって割り込まれた命令の次の命令" "から継続される」。 しかしこの文は SUSv2 で削除されたので、 現在の判断は「結果" "は定義されていない」である。" #. type: SH #: build/C/man2/getcontext.2:114 build/C/man3/makecontext.3:81 #: build/C/man3/pthread_attr_init.3:66 #: build/C/man3/pthread_attr_setaffinity_np.3:74 #: build/C/man3/pthread_attr_setdetachstate.3:75 #: build/C/man3/pthread_attr_setguardsize.3:88 #: build/C/man3/pthread_attr_setinheritsched.3:82 #: build/C/man3/pthread_attr_setschedparam.3:72 #: build/C/man3/pthread_attr_setschedpolicy.3:70 #: build/C/man3/pthread_attr_setscope.3:89 #: build/C/man3/pthread_attr_setstack.3:83 #: build/C/man3/pthread_attr_setstackaddr.3:72 #: build/C/man3/pthread_attr_setstacksize.3:59 #: build/C/man3/pthread_cancel.3:107 build/C/man3/pthread_cleanup_push.3:117 #: build/C/man3/pthread_create.3:113 build/C/man3/pthread_detach.3:47 #: build/C/man3/pthread_equal.3:39 build/C/man3/pthread_exit.3:69 #: build/C/man3/pthread_getattr_np.3:71 #: build/C/man3/pthread_getcpuclockid.3:44 build/C/man3/pthread_join.3:68 #: build/C/man3/pthread_kill.3:50 build/C/man3/pthread_self.3:44 #: build/C/man3/pthread_setaffinity_np.3:75 #: build/C/man3/pthread_setcancelstate.3:90 #: build/C/man3/pthread_setconcurrency.3:54 #: build/C/man3/pthread_setschedparam.3:102 #: build/C/man3/pthread_setschedprio.3:51 build/C/man3/pthread_sigmask.3:47 #: build/C/man3/pthread_sigqueue.3:63 build/C/man3/pthread_testcancel.3:48 #: build/C/man3/pthread_tryjoin_np.3:83 build/C/man3/pthread_yield.3:41 #, no-wrap msgid "RETURN VALUE" msgstr "返り値" #. type: Plain text #: build/C/man2/getcontext.2:122 msgid "" "When successful, B() returns 0 and B() does not " "return. On error, both return -1 and set I appropriately." msgstr "" "成功すると、 B() は 0 を返し、 B() は返らない。 失" "敗すると、両者とも -1 を返し、I をエラーに応じて設定する。" #. type: SH #: build/C/man2/getcontext.2:122 build/C/man3/makecontext.3:93 #: build/C/man3/pthread_attr_init.3:69 #: build/C/man3/pthread_attr_setaffinity_np.3:77 #: build/C/man3/pthread_attr_setdetachstate.3:78 #: build/C/man3/pthread_attr_setguardsize.3:91 #: build/C/man3/pthread_attr_setinheritsched.3:85 #: build/C/man3/pthread_attr_setschedparam.3:75 #: build/C/man3/pthread_attr_setschedpolicy.3:73 #: build/C/man3/pthread_attr_setscope.3:92 #: build/C/man3/pthread_attr_setstack.3:86 #: build/C/man3/pthread_attr_setstackaddr.3:75 #: build/C/man3/pthread_attr_setstacksize.3:62 #: build/C/man3/pthread_cancel.3:112 build/C/man3/pthread_cleanup_push.3:119 #: build/C/man3/pthread_create.3:120 build/C/man3/pthread_detach.3:52 #: build/C/man3/pthread_equal.3:43 build/C/man3/pthread_exit.3:71 #: build/C/man3/pthread_getattr_np.3:74 #: build/C/man3/pthread_getcpuclockid.3:47 build/C/man3/pthread_join.3:73 #: build/C/man3/pthread_kill.3:55 build/C/man3/pthread_self.3:46 #: build/C/man3/pthread_setaffinity_np.3:78 #: build/C/man3/pthread_setcancelstate.3:93 #: build/C/man3/pthread_setconcurrency.3:66 #: build/C/man3/pthread_setschedparam.3:110 #: build/C/man3/pthread_setschedprio.3:59 build/C/man3/pthread_sigmask.3:52 #: build/C/man3/pthread_sigqueue.3:68 build/C/man3/pthread_testcancel.3:52 #: build/C/man3/pthread_tryjoin_np.3:87 build/C/man3/pthread_yield.3:46 #, no-wrap msgid "ERRORS" msgstr "エラー" #. type: Plain text #: build/C/man2/getcontext.2:124 msgid "None defined." msgstr "定義されていない。" #. type: SH #: build/C/man2/getcontext.2:124 build/C/man3/makecontext.3:102 #: build/C/man3/pthread_attr_init.3:77 #: build/C/man3/pthread_attr_setaffinity_np.3:106 #: build/C/man3/pthread_attr_setdetachstate.3:85 #: build/C/man3/pthread_attr_setguardsize.3:104 #: build/C/man3/pthread_attr_setinheritsched.3:99 #: build/C/man3/pthread_attr_setschedparam.3:87 #: build/C/man3/pthread_attr_setschedpolicy.3:87 #: build/C/man3/pthread_attr_setscope.3:105 #: build/C/man3/pthread_attr_setstack.3:110 #: build/C/man3/pthread_attr_setstackaddr.3:81 #: build/C/man3/pthread_attr_setstacksize.3:81 #: build/C/man3/pthread_cancel.3:120 build/C/man3/pthread_cleanup_push.3:123 #: build/C/man3/pthread_cleanup_push_defer_np.3:99 #: build/C/man3/pthread_create.3:144 build/C/man3/pthread_detach.3:62 #: build/C/man3/pthread_equal.3:45 build/C/man3/pthread_exit.3:73 #: build/C/man3/pthread_getattr_np.3:96 #: build/C/man3/pthread_getcpuclockid.3:63 build/C/man3/pthread_join.3:96 #: build/C/man3/pthread_kill.3:64 #: build/C/man3/pthread_kill_other_threads_np.3:45 #: build/C/man3/pthread_self.3:48 build/C/man3/pthread_setaffinity_np.3:119 #: build/C/man3/pthread_setcancelstate.3:111 #: build/C/man3/pthread_setconcurrency.3:81 #: build/C/man3/pthread_setschedparam.3:139 #: build/C/man3/pthread_setschedprio.3:81 build/C/man3/pthread_sigmask.3:55 #: build/C/man3/pthread_sigqueue.3:91 build/C/man3/pthread_testcancel.3:56 #: build/C/man3/pthread_tryjoin_np.3:110 build/C/man3/pthread_yield.3:50 #, no-wrap msgid "CONFORMING TO" msgstr "準拠" #. type: Plain text #: build/C/man2/getcontext.2:130 msgid "" "SUSv2, POSIX.1-2001. POSIX.1-2008 removes the specification of B" "(), citing portability issues, and recommending that applications be " "rewritten to use POSIX threads instead." msgstr "" "SUSv2, POSIX.1-2001. POSIX.1-2008 では、移植性の問題から B() の" "仕様が削除された。 代わりに、アプリケーションを POSIX スレッドを使って書き直" "すことが 推奨されている。" #. type: SH #: build/C/man2/getcontext.2:130 build/C/man3/makecontext.3:110 #: build/C/man3/pthread_attr_init.3:79 #: build/C/man3/pthread_attr_setaffinity_np.3:109 #: build/C/man3/pthread_attr_setdetachstate.3:87 #: build/C/man3/pthread_attr_setguardsize.3:106 #: build/C/man3/pthread_attr_setschedparam.3:89 #: build/C/man3/pthread_attr_setscope.3:107 #: build/C/man3/pthread_attr_setstack.3:112 #: build/C/man3/pthread_attr_setstackaddr.3:84 #: build/C/man3/pthread_attr_setstacksize.3:83 #: build/C/man3/pthread_cancel.3:122 build/C/man3/pthread_cleanup_push.3:125 #: build/C/man3/pthread_create.3:146 build/C/man3/pthread_detach.3:64 #: build/C/man3/pthread_equal.3:47 build/C/man3/pthread_exit.3:75 #: build/C/man3/pthread_getcpuclockid.3:65 build/C/man3/pthread_join.3:98 #: build/C/man3/pthread_kill.3:66 #: build/C/man3/pthread_kill_other_threads_np.3:48 #: build/C/man3/pthread_self.3:50 build/C/man3/pthread_setaffinity_np.3:122 #: build/C/man3/pthread_setcancelstate.3:113 #: build/C/man3/pthread_setconcurrency.3:83 #: build/C/man3/pthread_setschedparam.3:141 #: build/C/man3/pthread_setschedprio.3:83 build/C/man3/pthread_sigmask.3:57 #: build/C/man3/pthread_yield.3:56 #, no-wrap msgid "NOTES" msgstr "注意" #. type: Plain text #: build/C/man2/getcontext.2:147 msgid "" "The earliest incarnation of this mechanism was the B(3)/B" "(3) mechanism. Since that does not define the handling of the signal " "context, the next stage was the B(3)/B(3) pair. The " "present mechanism gives much more control. On the other hand, there is no " "easy way to detect whether a return from B() is from the first " "call, or via a B() call. The user has to invent her own " "bookkeeping device, and a register variable won't do since registers are " "restored." msgstr "" "このメカニズムの最古の実装は、 B(3)/B(3) 機構であった。 こ" "れらにはシグナルコンテキストの取り扱いが定義されていなかったので、 次の段階で" "は B(3)/B(3) のペアが現われた。 現在の機構ではずっと" "細かな制御ができる。 一方 B() から返ったとき、 これが最初の呼び" "出しであったか、 それとも B() 呼び出しからのものであるかを 区別" "する容易な方法がなくなってしまった。 ユーザは「しおり」機構を自分で作らなけれ" "ばならない。 レジスタ変数は (レジスタはリストアされてしまうので) これをやって" "くれない。" #. type: Plain text #: build/C/man2/getcontext.2:158 msgid "" "When a signal occurs, the current user context is saved and a new context is " "created by the kernel for the signal handler. Do not leave the handler " "using B(3): it is undefined what would happen with contexts. Use " "B(3) or B() instead." msgstr "" "シグナルが発生すると、 現在のユーザコンテキストは保存され、 シグナルハンドラ" "用のコンテキストがカーネルによって生成される。 今後はハンドラに B" "(3) を使わせないこと: この関数のコンテキスト下での動作は定義されていない。 " "代わりに B(3) か B() を使うこと。" #. type: SH #: build/C/man2/getcontext.2:158 build/C/man3/makecontext.3:217 #: build/C/man3/pthread_attr_init.3:295 #: build/C/man3/pthread_attr_setaffinity_np.3:116 #: build/C/man3/pthread_attr_setdetachstate.3:109 #: build/C/man3/pthread_attr_setguardsize.3:156 #: build/C/man3/pthread_attr_setinheritsched.3:120 #: build/C/man3/pthread_attr_setschedparam.3:96 #: build/C/man3/pthread_attr_setschedpolicy.3:92 #: build/C/man3/pthread_attr_setscope.3:118 #: build/C/man3/pthread_attr_setstack.3:154 #: build/C/man3/pthread_attr_setstackaddr.3:108 #: build/C/man3/pthread_attr_setstacksize.3:109 #: build/C/man3/pthread_cancel.3:221 build/C/man3/pthread_cleanup_push.3:309 #: build/C/man3/pthread_cleanup_push_defer_np.3:102 #: build/C/man3/pthread_create.3:367 build/C/man3/pthread_detach.3:95 #: build/C/man3/pthread_equal.3:54 build/C/man3/pthread_exit.3:103 #: build/C/man3/pthread_getattr_np.3:343 #: build/C/man3/pthread_getcpuclockid.3:167 build/C/man3/pthread_join.3:125 #: build/C/man3/pthread_kill.3:73 #: build/C/man3/pthread_kill_other_threads_np.3:64 #: build/C/man3/pthread_self.3:74 build/C/man3/pthread_setaffinity_np.3:204 #: build/C/man3/pthread_setcancelstate.3:175 #: build/C/man3/pthread_setconcurrency.3:98 #: build/C/man3/pthread_setschedparam.3:429 #: build/C/man3/pthread_setschedprio.3:89 build/C/man3/pthread_sigmask.3:133 #: build/C/man3/pthread_sigqueue.3:93 build/C/man3/pthread_testcancel.3:61 #: build/C/man3/pthread_tryjoin_np.3:133 build/C/man3/pthread_yield.3:59 #: build/C/man7/pthreads.7:893 #, no-wrap msgid "SEE ALSO" msgstr "関連項目" #. type: Plain text #: build/C/man2/getcontext.2:164 msgid "" "B(2), B(2), B(2), B(3), " "B(3), B(3)" msgstr "" "B(2), B(2), B(2), B(3), " "B(3), B(3)" #. type: TH #: build/C/man3/makecontext.3:25 #, no-wrap msgid "MAKECONTEXT" msgstr "MAKECONTEXT" #. type: TH #: build/C/man3/makecontext.3:25 #, no-wrap msgid "2009-03-31" msgstr "2009-03-31" #. type: TH #: build/C/man3/makecontext.3:25 #, no-wrap msgid "GNU" msgstr "GNU" #. type: Plain text #: build/C/man3/makecontext.3:28 msgid "makecontext, swapcontext - manipulate user context" msgstr "makecontext, swapcontext - ユーザコンテキストを操作する" #. type: Plain text #: build/C/man3/makecontext.3:33 msgid "" "BIB<, void (*>IB<)(),> BIB<, ...);>" msgstr "" "BIB<, void (*>IB<)(),> BIB<, ...);>" #. type: Plain text #: build/C/man3/makecontext.3:35 msgid "BIB<, ucontext_t *>IB<);>" msgstr "BIB<, ucontext_t *>IB<);>" #. type: Plain text #: build/C/man3/makecontext.3:46 msgid "" "In a System V-like environment, one has the type I defined in " "Iucontext.hE> and the four functions B(2), " "B(2), B() and B() that allow user-" "level context switching between multiple threads of control within a process." msgstr "" "System V 的な環境では、 B および B という 2 つの型" "と、 B(2), B(2), B(), B() " "という 4 つの関数が Iucontext.hE> で定義されており、あるプロセス内" "部で制御下にある複数のスレッド間で、 ユーザレベルのコンテキスト切替えができる" "ようになっている。" #. type: Plain text #: build/C/man3/makecontext.3:49 msgid "For the type and the first two functions, see B(2)." msgstr "" "これらの型と、最初の 2 つの関数については、 B(2) を参照のこと。" #. type: Plain text #: build/C/man3/makecontext.3:61 msgid "" "The B() function modifies the context pointed to by I " "(which was obtained from a call to B(2)). Before invoking " "B(), the caller must allocate a new stack for this context and " "assign its address to Iuc_stack>, and define a successor context " "and assign its address to Iuc_link>." msgstr "" "B() 関数は、ポインタ I が指すコンテキストを変更する " "(I は以前の B(2) 呼び出しで得られたものである)。 " "B() を起動する前には、呼び出し者は、このコンテキスト用に 新しい" "スタックを確保し、そのアドレスを Iuc_stack> に代入し、 さらに後継の" "コンテキストを定義し、そのアドレスを Iuc_link> に 代入しなければな" "らない。" #. type: Plain text #: build/C/man3/makecontext.3:75 msgid "" "When this context is later activated (using B(2) or " "B()) the function I is called, and passed the series of " "integer (I) arguments that follow I; the caller must specify the " "number of these arguments in I. When this function returns, the " "successor context is activated. If the successor context pointer is NULL, " "the thread exits." msgstr "" "このコンテキストが将来 (B(2) または B() によっ" "て) 有効にされると、関数 I が呼ばれ、 引き数として I 以降の整数 " "(I) 引き数の列が渡される。 呼び出し者は I にこれらの引き数の個数" "を指定しなければならない。 この関数が戻ると、後継のコンテキストが有効にな" "る。 後継コンテキストのポインタが NULL の場合、そのスレッドが終了する。" #. type: Plain text #: build/C/man3/makecontext.3:81 msgid "" "The B() function saves the current context in the structure " "pointed to by I, and then activates the context pointed to by I." msgstr "" "B() 関数は現在のコンテキストを ポインタ I が指す構造体に" "保存し、 ポインタ I が指すコンテキストを有効にする。" #. type: Plain text #: build/C/man3/makecontext.3:93 msgid "" "When successful, B() does not return. (But we may return " "later, in case I is activated, in which case it looks like " "B() returns 0.) On error, B() returns -1 and " "sets I appropriately." msgstr "" "成功すると、 B() は返らない (しかし後に I が有効になった" "場合には返ることがある。 このときには B() は 0 を返すように見え" "る。) 失敗すると、 B() は -1 を返し、 I をエラーに応じ" "て設定する。" #. type: TP #: build/C/man3/makecontext.3:94 #: build/C/man3/pthread_attr_setaffinity_np.3:100 #: build/C/man3/pthread_getattr_np.3:75 #, no-wrap msgid "B" msgstr "B" #. type: Plain text #: build/C/man3/makecontext.3:97 msgid "Insufficient stack space left." msgstr "スタックに割り当てる空間が残っていない。" #. type: SH #: build/C/man3/makecontext.3:97 #: build/C/man3/pthread_attr_setaffinity_np.3:104 #: build/C/man3/pthread_attr_setguardsize.3:102 #: build/C/man3/pthread_attr_setstack.3:108 #: build/C/man3/pthread_attr_setstackaddr.3:79 #: build/C/man3/pthread_attr_setstacksize.3:79 #: build/C/man3/pthread_getattr_np.3:94 #: build/C/man3/pthread_getcpuclockid.3:61 #: build/C/man3/pthread_setaffinity_np.3:117 #: build/C/man3/pthread_setconcurrency.3:79 #: build/C/man3/pthread_setschedprio.3:79 build/C/man3/pthread_sigqueue.3:87 #: build/C/man3/pthread_tryjoin_np.3:108 #, no-wrap msgid "VERSIONS" msgstr "バージョン" #. type: Plain text #: build/C/man3/makecontext.3:102 msgid "" "B() and B() are provided in glibc since version " "2.1." msgstr "" "B() と B() は、バージョン 2.1 以降の glibc で提供" "されている。" #. type: Plain text #: build/C/man3/makecontext.3:110 msgid "" "SUSv2, POSIX.1-2001. POSIX.1-2008 removes the specifications of " "B() and B(), citing portability issues, and " "recommending that applications be rewritten to use POSIX threads instead." msgstr "" "SUSv2, POSIX.1-2001. POSIX.1-2008 では、移植性の問題から B() " "と B() の仕様が削除されている。 代わりに、アプリケーションを " "POSIX スレッドを使って書き直すことが 推奨されている。" #. type: Plain text #: build/C/man3/makecontext.3:118 msgid "" "The interpretation of Iuc_stack> is just as in B(2), " "namely, this struct contains the start and length of a memory area to be " "used as the stack, regardless of the direction of growth of the stack. " "Thus, it is not necessary for the user program to worry about this direction." msgstr "" "Iuc_stack> の解釈は B(2) の場合と同じである。 すなわ" "ちこの構造体には、 スタックとして用いられるメモリ領域の開始アドレスと長さが含" "まれ、 これはスタックが伸びる方向がどちらであるかには関係しない。 したがっ" "て、ユーザプログラムはこの件については心配しなくてよい。" #. type: Plain text #: build/C/man3/makecontext.3:134 msgid "" "On architectures where I and pointer types are the same size (e.g., " "x86-32, where both types are 32 bits), you may be able to get away with " "passing pointers as arguments to B() following I. " "However, doing this is not guaranteed to be portable, is undefined according " "to the standards, and won't work on architectures where pointers are larger " "than Is. Nevertheless, starting with version 2.8, glibc makes some " "changes to B(), to permit this on some 64-bit architectures (e." "g., x86-64)." msgstr "" "I とポインタ型が同じ大きさであるアーキテクチャでは (x86-32 はその例であ" "り、両方の型とも 32 ビットである)、 B() の I 以降の引き数" "としてポインタを渡してもうまく動くかもしれない。 しかしながら、このようにする" "と、移植性は保証されず、 標準に従えば動作は未定義であり、ポインタが I よ" "りも大きいアーキテクチャでは正しく動作しないことだろう。 それにも関わらず、" "バージョン 2.8 以降の glibc では、 B() に変更が行われ、(x86-64 " "などの) いくつかの 64 ビットアーキテクチャで 引き数としてポインタを渡すことが" "できるようになっている。" #. type: SH #: build/C/man3/makecontext.3:134 build/C/man3/pthread_attr_init.3:85 #: build/C/man3/pthread_attr_setdetachstate.3:106 #: build/C/man3/pthread_attr_setguardsize.3:153 #: build/C/man3/pthread_attr_setinheritsched.3:117 #: build/C/man3/pthread_attr_setschedparam.3:93 #: build/C/man3/pthread_attr_setschedpolicy.3:89 #: build/C/man3/pthread_attr_setstack.3:151 #: build/C/man3/pthread_attr_setstacksize.3:106 #: build/C/man3/pthread_cancel.3:130 build/C/man3/pthread_cleanup_push.3:149 #: build/C/man3/pthread_create.3:200 build/C/man3/pthread_detach.3:91 #: build/C/man3/pthread_getattr_np.3:99 #: build/C/man3/pthread_getcpuclockid.3:76 build/C/man3/pthread_join.3:122 #: build/C/man3/pthread_setaffinity_np.3:152 #: build/C/man3/pthread_setcancelstate.3:172 #: build/C/man3/pthread_setschedparam.3:147 build/C/man3/pthread_sigmask.3:59 #: build/C/man3/pthread_testcancel.3:58 build/C/man3/pthread_tryjoin_np.3:113 #, no-wrap msgid "EXAMPLE" msgstr "例" #. type: Plain text #: build/C/man3/makecontext.3:142 msgid "" "The example program below demonstrates the use of B(2), " "B(), and B(). Running the program produces the " "following output:" msgstr "" "以下のサンプル・プログラムは、 B(2), B(), " "B() の使用方法の例を示すものである。 このプログラムを実行する" "と、以下のような出力が得られる:" #. type: Plain text #: build/C/man3/makecontext.3:154 #, no-wrap msgid "" "$B< ./a.out>\n" "main: swapcontext(&uctx_main, &uctx_func2)\n" "func2: started\n" "func2: swapcontext(&uctx_func2, &uctx_func1)\n" "func1: started\n" "func1: swapcontext(&uctx_func1, &uctx_func2)\n" "func2: returning\n" "func1: returning\n" "main: exiting\n" msgstr "" "$B< ./a.out>\n" "main: swapcontext(&uctx_main, &uctx_func2)\n" "func2: started\n" "func2: swapcontext(&uctx_func2, &uctx_func1)\n" "func1: started\n" "func1: swapcontext(&uctx_func1, &uctx_func2)\n" "func2: returning\n" "func1: returning\n" "main: exiting\n" #. type: SS #: build/C/man3/makecontext.3:156 build/C/man3/pthread_attr_init.3:146 #: build/C/man3/pthread_cancel.3:146 build/C/man3/pthread_cleanup_push.3:225 #: build/C/man3/pthread_create.3:239 build/C/man3/pthread_getattr_np.3:177 #: build/C/man3/pthread_getcpuclockid.3:93 #: build/C/man3/pthread_setschedparam.3:222 build/C/man3/pthread_sigmask.3:77 #, no-wrap msgid "Program source" msgstr "プログラムのソース" #. type: Plain text #: build/C/man3/makecontext.3:162 #, no-wrap msgid "" "#include Eucontext.hE\n" "#include Estdio.hE\n" "#include Estdlib.hE\n" msgstr "" "#include Eucontext.hE\n" "#include Estdio.hE\n" "#include Estdlib.hE\n" #. type: Plain text #: build/C/man3/makecontext.3:164 #, no-wrap msgid "static ucontext_t uctx_main, uctx_func1, uctx_func2;\n" msgstr "static ucontext_t uctx_main, uctx_func1, uctx_func2;\n" #. type: Plain text #: build/C/man3/makecontext.3:167 #, no-wrap msgid "" "#define handle_error(msg) \\e\n" " do { perror(msg); exit(EXIT_FAILURE); } while (0)\n" msgstr "" "#define handle_error(msg) \\e\n" " do { perror(msg); exit(EXIT_FAILURE); } while (0)\n" #. type: Plain text #: build/C/man3/makecontext.3:177 #, no-wrap msgid "" "static void\n" "func1(void)\n" "{\n" " printf(\"func1: started\\en\");\n" " printf(\"func1: swapcontext(&uctx_func1, &uctx_func2)\\en\");\n" " if (swapcontext(&uctx_func1, &uctx_func2) == -1)\n" " handle_error(\"swapcontext\");\n" " printf(\"func1: returning\\en\");\n" "}\n" msgstr "" "static void\n" "func1(void)\n" "{\n" " printf(\"func1: started\\en\");\n" " printf(\"func1: swapcontext(&uctx_func1, &uctx_func2)\\en\");\n" " if (swapcontext(&uctx_func1, &uctx_func2) == -1)\n" " handle_error(\"swapcontext\");\n" " printf(\"func1: returning\\en\");\n" "}\n" #. type: Plain text #: build/C/man3/makecontext.3:187 #, no-wrap msgid "" "static void\n" "func2(void)\n" "{\n" " printf(\"func2: started\\en\");\n" " printf(\"func2: swapcontext(&uctx_func2, &uctx_func1)\\en\");\n" " if (swapcontext(&uctx_func2, &uctx_func1) == -1)\n" " handle_error(\"swapcontext\");\n" " printf(\"func2: returning\\en\");\n" "}\n" msgstr "" "static void\n" "func2(void)\n" "{\n" " printf(\"func2: started\\en\");\n" " printf(\"func2: swapcontext(&uctx_func2, &uctx_func1)\\en\");\n" " if (swapcontext(&uctx_func2, &uctx_func1) == -1)\n" " handle_error(\"swapcontext\");\n" " printf(\"func2: returning\\en\");\n" "}\n" #. type: Plain text #: build/C/man3/makecontext.3:193 #, no-wrap msgid "" "int\n" "main(int argc, char *argv[])\n" "{\n" " char func1_stack[16384];\n" " char func2_stack[16384];\n" msgstr "" "int\n" "main(int argc, char *argv[])\n" "{\n" " char func1_stack[16384];\n" " char func2_stack[16384];\n" #. type: Plain text #: build/C/man3/makecontext.3:200 #, no-wrap msgid "" " if (getcontext(&uctx_func1) == -1)\n" " handle_error(\"getcontext\");\n" " uctx_func1.uc_stack.ss_sp = func1_stack;\n" " uctx_func1.uc_stack.ss_size = sizeof(func1_stack);\n" " uctx_func1.uc_link = &uctx_main;\n" " makecontext(&uctx_func1, func1, 0);\n" msgstr "" " if (getcontext(&uctx_func1) == -1)\n" " handle_error(\"getcontext\");\n" " uctx_func1.uc_stack.ss_sp = func1_stack;\n" " uctx_func1.uc_stack.ss_size = sizeof(func1_stack);\n" " uctx_func1.uc_link = &uctx_main;\n" " makecontext(&uctx_func1, func1, 0);\n" #. type: Plain text #: build/C/man3/makecontext.3:208 #, no-wrap msgid "" " if (getcontext(&uctx_func2) == -1)\n" " handle_error(\"getcontext\");\n" " uctx_func2.uc_stack.ss_sp = func2_stack;\n" " uctx_func2.uc_stack.ss_size = sizeof(func2_stack);\n" " /* Successor context is f1(), unless argc E 1 */\n" " uctx_func2.uc_link = (argc E 1) ? NULL : &uctx_func1;\n" " makecontext(&uctx_func2, func2, 0);\n" msgstr "" " if (getcontext(&uctx_func2) == -1)\n" " handle_error(\"getcontext\");\n" " uctx_func2.uc_stack.ss_sp = func2_stack;\n" " uctx_func2.uc_stack.ss_size = sizeof(func2_stack);\n" " /* Successor context is f1(), unless argc E 1 */\n" " uctx_func2.uc_link = (argc E 1) ? NULL : &uctx_func1;\n" " makecontext(&uctx_func2, func2, 0);\n" #. type: Plain text #: build/C/man3/makecontext.3:212 #, no-wrap msgid "" " printf(\"main: swapcontext(&uctx_main, &uctx_func2)\\en\");\n" " if (swapcontext(&uctx_main, &uctx_func2) == -1)\n" " handle_error(\"swapcontext\");\n" msgstr "" " printf(\"main: swapcontext(&uctx_main, &uctx_func2)\\en\");\n" " if (swapcontext(&uctx_main, &uctx_func2) == -1)\n" " handle_error(\"swapcontext\");\n" #. type: Plain text #: build/C/man3/makecontext.3:216 #, no-wrap msgid "" " printf(\"main: exiting\\en\");\n" " exit(EXIT_SUCCESS);\n" "}\n" msgstr "" " printf(\"main: exiting\\en\");\n" " exit(EXIT_SUCCESS);\n" "}\n" #. type: Plain text #: build/C/man3/makecontext.3:222 msgid "" "B(2), B(2), B(2), B(2), " "B(3)" msgstr "" "B(2), B(2), B(2), B(2), " "B(3)" #. type: TH #: build/C/man3/pthread_attr_init.3:24 #, no-wrap msgid "PTHREAD_ATTR_INIT" msgstr "PTHREAD_ATTR_INIT" #. type: TH #: build/C/man3/pthread_attr_init.3:24 #, no-wrap msgid "2008-11-11" msgstr "2008-11-11" #. type: Plain text #: build/C/man3/pthread_attr_init.3:28 msgid "" "pthread_attr_init, pthread_attr_destroy - initialize and destroy thread " "attributes object" msgstr "" #. type: Plain text #: build/C/man3/pthread_attr_init.3:31 #: build/C/man3/pthread_attr_setdetachstate.3:31 #: build/C/man3/pthread_attr_setguardsize.3:31 #: build/C/man3/pthread_attr_setinheritsched.3:31 #: build/C/man3/pthread_attr_setschedparam.3:31 #: build/C/man3/pthread_attr_setschedpolicy.3:31 #: build/C/man3/pthread_attr_setscope.3:31 #: build/C/man3/pthread_attr_setstack.3:31 #: build/C/man3/pthread_attr_setstackaddr.3:31 #: build/C/man3/pthread_attr_setstacksize.3:31 #: build/C/man3/pthread_cancel.3:30 build/C/man3/pthread_cleanup_push.3:31 #: build/C/man3/pthread_cleanup_push_defer_np.3:31 #: build/C/man3/pthread_create.3:30 build/C/man3/pthread_detach.3:30 #: build/C/man3/pthread_equal.3:30 build/C/man3/pthread_exit.3:30 #: build/C/man3/pthread_join.3:30 #: build/C/man3/pthread_kill_other_threads_np.3:30 #: build/C/man3/pthread_self.3:30 build/C/man3/pthread_setcancelstate.3:31 #: build/C/man3/pthread_setconcurrency.3:30 #: build/C/man3/pthread_setschedparam.3:31 #: build/C/man3/pthread_setschedprio.3:30 build/C/man3/pthread_sigqueue.3:29 #: build/C/man3/pthread_testcancel.3:30 build/C/man3/pthread_yield.3:29 #, no-wrap msgid "B<#include Epthread.hE>\n" msgstr "B<#include Epthread.hE>\n" #. type: Plain text #: build/C/man3/pthread_attr_init.3:34 #, no-wrap msgid "" "BIB<);>\n" "BIB<);>\n" msgstr "" "BIB<);>\n" "BIB<);>\n" #. type: Plain text #: build/C/man3/pthread_attr_init.3:36 #: build/C/man3/pthread_attr_setaffinity_np.3:39 #: build/C/man3/pthread_attr_setdetachstate.3:38 #: build/C/man3/pthread_attr_setguardsize.3:38 #: build/C/man3/pthread_attr_setinheritsched.3:38 #: build/C/man3/pthread_attr_setschedparam.3:38 #: build/C/man3/pthread_attr_setschedpolicy.3:38 #: build/C/man3/pthread_attr_setscope.3:38 #: build/C/man3/pthread_attr_setstack.3:38 #: build/C/man3/pthread_attr_setstackaddr.3:38 #: build/C/man3/pthread_attr_setstacksize.3:38 #: build/C/man3/pthread_cancel.3:34 build/C/man3/pthread_cleanup_push.3:37 #: build/C/man3/pthread_equal.3:34 build/C/man3/pthread_exit.3:34 #: build/C/man3/pthread_getattr_np.3:35 #: build/C/man3/pthread_getcpuclockid.3:35 build/C/man3/pthread_self.3:34 #: build/C/man3/pthread_setaffinity_np.3:39 #: build/C/man3/pthread_setcancelstate.3:36 #: build/C/man3/pthread_setconcurrency.3:35 #: build/C/man3/pthread_setschedparam.3:38 #: build/C/man3/pthread_setschedprio.3:34 build/C/man3/pthread_testcancel.3:34 #, no-wrap msgid "Compile and link with I<-pthread>.\n" msgstr "" #. type: Plain text #: build/C/man3/pthread_attr_init.3:48 msgid "" "The B() function initializes the thread attributes " "object pointed to by I with default attribute values. After this " "call, individual attributes of the object can be set using various related " "functions (listed under SEE ALSO), and then the object can be used in one or " "more B(3) calls that create threads." msgstr "" #. type: Plain text #: build/C/man3/pthread_attr_init.3:53 msgid "" "Calling B() on a thread attributes object that has " "already been initialized results in undefined behavior." msgstr "" #. type: Plain text #: build/C/man3/pthread_attr_init.3:60 msgid "" "When a thread attributes object is no longer required, it should be " "destroyed using the B() function. Destroying a " "thread attributes object has no effect on threads that were created using " "that object." msgstr "" #. type: Plain text #: build/C/man3/pthread_attr_init.3:66 msgid "" "Once a thread attributes object has been destroyed, it can be reinitialized " "using B(). Any other use of a destroyed thread " "attributes object has undefined results." msgstr "" #. type: Plain text #: build/C/man3/pthread_attr_init.3:69 #: build/C/man3/pthread_attr_setaffinity_np.3:77 #: build/C/man3/pthread_attr_setdetachstate.3:78 #: build/C/man3/pthread_attr_setguardsize.3:91 #: build/C/man3/pthread_attr_setinheritsched.3:85 #: build/C/man3/pthread_attr_setschedparam.3:75 #: build/C/man3/pthread_attr_setschedpolicy.3:73 #: build/C/man3/pthread_attr_setscope.3:92 #: build/C/man3/pthread_attr_setstack.3:86 #: build/C/man3/pthread_attr_setstackaddr.3:75 #: build/C/man3/pthread_attr_setstacksize.3:62 #: build/C/man3/pthread_setaffinity_np.3:78 #: build/C/man3/pthread_setcancelstate.3:93 msgid "" "On success, these functions return 0; on error, they return a nonzero error " "number." msgstr "" #. type: Plain text #: build/C/man3/pthread_attr_init.3:77 msgid "" "POSIX.1-2001 documents an B error for B(); on " "Linux these functions always succeed (but portable and future-proof " "applications should nevertheless handle a possible error return)." msgstr "" #. type: Plain text #: build/C/man3/pthread_attr_init.3:79 #: build/C/man3/pthread_attr_setdetachstate.3:87 #: build/C/man3/pthread_attr_setguardsize.3:106 #: build/C/man3/pthread_attr_setinheritsched.3:101 #: build/C/man3/pthread_attr_setschedparam.3:89 #: build/C/man3/pthread_attr_setschedpolicy.3:89 #: build/C/man3/pthread_attr_setscope.3:107 #: build/C/man3/pthread_attr_setstack.3:112 #: build/C/man3/pthread_attr_setstacksize.3:83 #: build/C/man3/pthread_cancel.3:122 build/C/man3/pthread_cleanup_push.3:125 #: build/C/man3/pthread_create.3:146 build/C/man3/pthread_detach.3:64 #: build/C/man3/pthread_equal.3:47 build/C/man3/pthread_exit.3:75 #: build/C/man3/pthread_getcpuclockid.3:65 build/C/man3/pthread_join.3:98 #: build/C/man3/pthread_kill.3:66 build/C/man3/pthread_self.3:50 #: build/C/man3/pthread_setcancelstate.3:113 #: build/C/man3/pthread_setconcurrency.3:83 #: build/C/man3/pthread_setschedparam.3:141 #: build/C/man3/pthread_setschedprio.3:83 build/C/man3/pthread_sigmask.3:57 #: build/C/man3/pthread_testcancel.3:58 msgid "POSIX.1-2001." msgstr "" #. type: Plain text #: build/C/man3/pthread_attr_init.3:85 msgid "" "The I type should be treated as opaque: any access to the " "object other than via pthreads functions is nonportable and produces " "undefined results." msgstr "" #. type: Plain text #: build/C/man3/pthread_attr_init.3:94 msgid "" "The program below optionally makes use of B() and " "various related functions to initialize a thread attributes object that is " "used to create a single thread. Once created, the thread uses the " "B(3) function (a nonstandard GNU extension) to retrieve " "the thread's attributes, and then displays those attributes." msgstr "" #. type: Plain text #: build/C/man3/pthread_attr_init.3:103 msgid "" "If the program is run with no command-line argument, then it passes NULL as " "the I argument of B(3), so that the thread is created " "with default attributes. Running the program on Linux/x86-32 with the NPTL " "threading implementation, we see the following:" msgstr "" #. Results from glibc 2.8, SUSE 11.0; Oct 2008 #. type: Plain text #: build/C/man3/pthread_attr_init.3:119 #, no-wrap msgid "" "$B< ulimit -s> # No stack imit ==E default stack size is 2MB\n" "unlimited\n" "$B< ./a.out>\n" "Thread attributes:\n" " Detach state = PTHREAD_CREATE_JOINABLE\n" " Scope = PTHREAD_SCOPE_SYSTEM\n" " Inherit scheduler = PTHREAD_INHERIT_SCHED\n" " Scheduling policy = SCHED_OTHER\n" " Scheduling priority = 0\n" " Guard size = 4096 bytes\n" " Stack address = 0x40196000\n" " Stack size = 0x201000 bytes\n" msgstr "" "$B< ulimit -s> # No stack imit ==E default stack size is 2MB\n" "unlimited\n" "$B< ./a.out>\n" "Thread attributes:\n" " Detach state = PTHREAD_CREATE_JOINABLE\n" " Scope = PTHREAD_SCOPE_SYSTEM\n" " Inherit scheduler = PTHREAD_INHERIT_SCHED\n" " Scheduling policy = SCHED_OTHER\n" " Scheduling priority = 0\n" " Guard size = 4096 bytes\n" " Stack address = 0x40196000\n" " Stack size = 0x201000 bytes\n" #. type: Plain text #: build/C/man3/pthread_attr_init.3:129 msgid "" "When we supply a stack size as a command-line argument, the program " "initializes a thread attributes object, sets various attributes in that " "object, and passes a pointer to the object in the call to B" "(3). Running the program on Linux/x86-32 with the NPTL threading " "implementation, we see the following:" msgstr "" #. Results from glibc 2.8, SUSE 11.0; Oct 2008 #. type: Plain text #: build/C/man3/pthread_attr_init.3:144 #, no-wrap msgid "" "$B< ./a.out 0x3000000>\n" "posix_memalign() allocated at 0x40197000\n" "Thread attributes:\n" " Detach state = PTHREAD_CREATE_DETACHED\n" " Scope = PTHREAD_SCOPE_SYSTEM\n" " Inherit scheduler = PTHREAD_EXPLICIT_SCHED\n" " Scheduling policy = SCHED_OTHER\n" " Scheduling priority = 0\n" " Guard size = 0 bytes\n" " Stack address = 0x40197000\n" " Stack size = 0x3000000 bytes\n" msgstr "" "$B< ./a.out 0x3000000>\n" "posix_memalign() allocated at 0x40197000\n" "Thread attributes:\n" " Detach state = PTHREAD_CREATE_DETACHED\n" " Scope = PTHREAD_SCOPE_SYSTEM\n" " Inherit scheduler = PTHREAD_EXPLICIT_SCHED\n" " Scheduling policy = SCHED_OTHER\n" " Scheduling priority = 0\n" " Guard size = 0 bytes\n" " Stack address = 0x40197000\n" " Stack size = 0x3000000 bytes\n" #. type: Plain text #: build/C/man3/pthread_attr_init.3:155 build/C/man3/pthread_getattr_np.3:186 #, no-wrap msgid "" "#define _GNU_SOURCE /* To get pthread_getattr_np() declaration */\n" "#include Epthread.hE\n" "#include Estdio.hE\n" "#include Estdlib.hE\n" "#include Eunistd.hE\n" "#include Eerrno.hE\n" msgstr "" "#define _GNU_SOURCE /* To get pthread_getattr_np() declaration */\n" "#include Epthread.hE\n" "#include Estdio.hE\n" "#include Estdlib.hE\n" "#include Eunistd.hE\n" "#include Eerrno.hE\n" #. type: Plain text #: build/C/man3/pthread_attr_init.3:158 build/C/man3/pthread_cancel.3:157 #: build/C/man3/pthread_cleanup_push.3:237 build/C/man3/pthread_create.3:252 #: build/C/man3/pthread_getattr_np.3:189 #: build/C/man3/pthread_getcpuclockid.3:111 #: build/C/man3/pthread_setaffinity_np.3:170 #: build/C/man3/pthread_setschedparam.3:235 build/C/man3/pthread_sigmask.3:91 #, no-wrap msgid "" "#define handle_error_en(en, msg) \\e\n" " do { errno = en; perror(msg); exit(EXIT_FAILURE); } while (0)\n" msgstr "" "#define handle_error_en(en, msg) \\e\n" " do { errno = en; perror(msg); exit(EXIT_FAILURE); } while (0)\n" #. type: Plain text #: build/C/man3/pthread_attr_init.3:166 #, no-wrap msgid "" "static void\n" "display_pthread_attr(pthread_attr_t *attr, char *prefix)\n" "{\n" " int s, i;\n" " size_t v;\n" " void *stkaddr;\n" " struct sched_param sp;\n" msgstr "" "static void\n" "display_pthread_attr(pthread_attr_t *attr, char *prefix)\n" "{\n" " int s, i;\n" " size_t v;\n" " void *stkaddr;\n" " struct sched_param sp;\n" #. type: Plain text #: build/C/man3/pthread_attr_init.3:174 #, no-wrap msgid "" " s = pthread_attr_getdetachstate(attr, &i);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_attr_getdetachstate\");\n" " printf(\"%sDetach state = %s\\en\", prefix,\n" " (i == PTHREAD_CREATE_DETACHED) ? \"PTHREAD_CREATE_DETACHED\" :\n" " (i == PTHREAD_CREATE_JOINABLE) ? \"PTHREAD_CREATE_JOINABLE\" :\n" " \"???\");\n" msgstr "" " s = pthread_attr_getdetachstate(attr, &i);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_attr_getdetachstate\");\n" " printf(\"%sDetach state = %s\\en\", prefix,\n" " (i == PTHREAD_CREATE_DETACHED) ? \"PTHREAD_CREATE_DETACHED\" :\n" " (i == PTHREAD_CREATE_JOINABLE) ? \"PTHREAD_CREATE_JOINABLE\" :\n" " \"???\");\n" #. type: Plain text #: build/C/man3/pthread_attr_init.3:182 #, no-wrap msgid "" " s = pthread_attr_getscope(attr, &i);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_attr_getscope\");\n" " printf(\"%sScope = %s\\en\", prefix,\n" " (i == PTHREAD_SCOPE_SYSTEM) ? \"PTHREAD_SCOPE_SYSTEM\" :\n" " (i == PTHREAD_SCOPE_PROCESS) ? \"PTHREAD_SCOPE_PROCESS\" :\n" " \"???\");\n" msgstr "" " s = pthread_attr_getscope(attr, &i);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_attr_getscope\");\n" " printf(\"%sScope = %s\\en\", prefix,\n" " (i == PTHREAD_SCOPE_SYSTEM) ? \"PTHREAD_SCOPE_SYSTEM\" :\n" " (i == PTHREAD_SCOPE_PROCESS) ? \"PTHREAD_SCOPE_PROCESS\" :\n" " \"???\");\n" #. type: Plain text #: build/C/man3/pthread_attr_init.3:190 #, no-wrap msgid "" " s = pthread_attr_getinheritsched(attr, &i);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_attr_getinheritsched\");\n" " printf(\"%sInherit scheduler = %s\\en\", prefix,\n" " (i == PTHREAD_INHERIT_SCHED) ? \"PTHREAD_INHERIT_SCHED\" :\n" " (i == PTHREAD_EXPLICIT_SCHED) ? \"PTHREAD_EXPLICIT_SCHED\" :\n" " \"???\");\n" msgstr "" " s = pthread_attr_getinheritsched(attr, &i);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_attr_getinheritsched\");\n" " printf(\"%sInherit scheduler = %s\\en\", prefix,\n" " (i == PTHREAD_INHERIT_SCHED) ? \"PTHREAD_INHERIT_SCHED\" :\n" " (i == PTHREAD_EXPLICIT_SCHED) ? \"PTHREAD_EXPLICIT_SCHED\" :\n" " \"???\");\n" #. type: Plain text #: build/C/man3/pthread_attr_init.3:199 #, no-wrap msgid "" " s = pthread_attr_getschedpolicy(attr, &i);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_attr_getschedpolicy\");\n" " printf(\"%sScheduling policy = %s\\en\", prefix,\n" " (i == SCHED_OTHER) ? \"SCHED_OTHER\" :\n" " (i == SCHED_FIFO) ? \"SCHED_FIFO\" :\n" " (i == SCHED_RR) ? \"SCHED_RR\" :\n" " \"???\");\n" msgstr "" " s = pthread_attr_getschedpolicy(attr, &i);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_attr_getschedpolicy\");\n" " printf(\"%sScheduling policy = %s\\en\", prefix,\n" " (i == SCHED_OTHER) ? \"SCHED_OTHER\" :\n" " (i == SCHED_FIFO) ? \"SCHED_FIFO\" :\n" " (i == SCHED_RR) ? \"SCHED_RR\" :\n" " \"???\");\n" #. type: Plain text #: build/C/man3/pthread_attr_init.3:204 #, no-wrap msgid "" " s = pthread_attr_getschedparam(attr, &sp);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_attr_getschedparam\");\n" " printf(\"%sScheduling priority = %d\\en\", prefix, sp.sched_priority);\n" msgstr "" " s = pthread_attr_getschedparam(attr, &sp);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_attr_getschedparam\");\n" " printf(\"%sScheduling priority = %d\\en\", prefix, sp.sched_priority);\n" #. type: Plain text #: build/C/man3/pthread_attr_init.3:209 #, no-wrap msgid "" " s = pthread_attr_getguardsize(attr, &v);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_attr_getguardsize\");\n" " printf(\"%sGuard size = %d bytes\\en\", prefix, v);\n" msgstr "" " s = pthread_attr_getguardsize(attr, &v);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_attr_getguardsize\");\n" " printf(\"%sGuard size = %d bytes\\en\", prefix, v);\n" #. type: Plain text #: build/C/man3/pthread_attr_init.3:216 #, no-wrap msgid "" " s = pthread_attr_getstack(attr, &stkaddr, &v);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_attr_getstack\");\n" " printf(\"%sStack address = %p\\en\", prefix, stkaddr);\n" " printf(\"%sStack size = 0x%x bytes\\en\", prefix, v);\n" "}\n" msgstr "" " s = pthread_attr_getstack(attr, &stkaddr, &v);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_attr_getstack\");\n" " printf(\"%sStack address = %p\\en\", prefix, stkaddr);\n" " printf(\"%sStack size = 0x%x bytes\\en\", prefix, v);\n" "}\n" #. type: Plain text #: build/C/man3/pthread_attr_init.3:222 #, no-wrap msgid "" "static void *\n" "thread_start(void *arg)\n" "{\n" " int s;\n" " pthread_attr_t gattr;\n" msgstr "" "static void *\n" "thread_start(void *arg)\n" "{\n" " int s;\n" " pthread_attr_t gattr;\n" #. type: Plain text #: build/C/man3/pthread_attr_init.3:226 #, no-wrap msgid "" " /* pthread_getattr_np() is a non-standard GNU extension that\n" " retrieves the attributes of the thread specified in its\n" " first argument */\n" msgstr "" " /* pthread_getattr_np() is a non-standard GNU extension that\n" " retrieves the attributes of the thread specified in its\n" " first argument */\n" #. type: Plain text #: build/C/man3/pthread_attr_init.3:230 #, no-wrap msgid "" " s = pthread_getattr_np(pthread_self(), &gattr);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_getattr_np\");\n" msgstr "" " s = pthread_getattr_np(pthread_self(), &gattr);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_getattr_np\");\n" #. type: Plain text #: build/C/man3/pthread_attr_init.3:233 #, no-wrap msgid "" " printf(\"Thread attributes:\\en\");\n" " display_pthread_attr(&gattr, \"\\et\");\n" msgstr "" " printf(\"Thread attributes:\\en\");\n" " display_pthread_attr(&gattr, \"\\et\");\n" #. type: Plain text #: build/C/man3/pthread_attr_init.3:236 build/C/man3/pthread_getattr_np.3:238 #, no-wrap msgid "" " exit(EXIT_SUCCESS); /* Terminate all threads */\n" "}\n" msgstr "" " exit(EXIT_SUCCESS); /* Terminate all threads */\n" "}\n" #. type: Plain text #: build/C/man3/pthread_attr_init.3:244 #, no-wrap msgid "" "int\n" "main(int argc, char *argv[])\n" "{\n" " pthread_t thr;\n" " pthread_attr_t attr;\n" " pthread_attr_t *attrp; /* NULL or &attr */\n" " int s;\n" msgstr "" "int\n" "main(int argc, char *argv[])\n" "{\n" " pthread_t thr;\n" " pthread_attr_t attr;\n" " pthread_attr_t *attrp; /* NULL or &attr */\n" " int s;\n" #. type: Plain text #: build/C/man3/pthread_attr_init.3:246 #: build/C/man3/pthread_setschedparam.3:353 #, no-wrap msgid " attrp = NULL;\n" msgstr " attrp = NULL;\n" #. type: Plain text #: build/C/man3/pthread_attr_init.3:250 #, no-wrap msgid "" " /* If a command-line argument was supplied, use it to set the\n" " stack-size attribute and set a few other thread attributes,\n" " and set attrp pointing to thread attributes object */\n" msgstr "" " /* If a command-line argument was supplied, use it to set the\n" " stack-size attribute and set a few other thread attributes,\n" " and set attrp pointing to thread attributes object */\n" #. type: Plain text #: build/C/man3/pthread_attr_init.3:254 #, no-wrap msgid "" " if (argc E 1) {\n" " int stack_size;\n" " void *sp;\n" msgstr "" " if (argc E 1) {\n" " int stack_size;\n" " void *sp;\n" #. type: Plain text #: build/C/man3/pthread_attr_init.3:256 #, no-wrap msgid " attrp = &attr;\n" msgstr " attrp = &attr;\n" #. type: Plain text #: build/C/man3/pthread_attr_init.3:260 #, no-wrap msgid "" " s = pthread_attr_init(&attr);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_attr_init\");\n" msgstr "" " s = pthread_attr_init(&attr);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_attr_init\");\n" #. type: Plain text #: build/C/man3/pthread_attr_init.3:264 #, no-wrap msgid "" " s = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_attr_setdetachstate\");\n" msgstr "" " s = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_attr_setdetachstate\");\n" #. type: Plain text #: build/C/man3/pthread_attr_init.3:268 #, no-wrap msgid "" " s = pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_attr_setinheritsched\");\n" msgstr "" " s = pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_attr_setinheritsched\");\n" #. type: Plain text #: build/C/man3/pthread_attr_init.3:270 #, no-wrap msgid " stack_size = strtoul(argv[1], NULL, 0);\n" msgstr " stack_size = strtoul(argv[1], NULL, 0);\n" #. type: Plain text #: build/C/man3/pthread_attr_init.3:274 #, no-wrap msgid "" " s = posix_memalign(&sp, sysconf(_SC_PAGESIZE), stack_size);\n" " if (s != 0)\n" " handle_error_en(s, \"posix_memalign\");\n" msgstr "" " s = posix_memalign(&sp, sysconf(_SC_PAGESIZE), stack_size);\n" " if (s != 0)\n" " handle_error_en(s, \"posix_memalign\");\n" #. type: Plain text #: build/C/man3/pthread_attr_init.3:276 #, no-wrap msgid " printf(\"posix_memalign() allocated at %p\\en\", sp);\n" msgstr " printf(\"posix_memalign() allocated at %p\\en\", sp);\n" #. type: Plain text #: build/C/man3/pthread_attr_init.3:281 #, no-wrap msgid "" " s = pthread_attr_setstack(&attr, sp, stack_size);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_attr_setstack\");\n" " }\n" msgstr "" " s = pthread_attr_setstack(&attr, sp, stack_size);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_attr_setstack\");\n" " }\n" #. type: Plain text #: build/C/man3/pthread_attr_init.3:285 build/C/man3/pthread_getattr_np.3:333 #, no-wrap msgid "" " s = pthread_create(&thr, attrp, &thread_start, NULL);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_create\");\n" msgstr "" " s = pthread_create(&thr, attrp, &thread_start, NULL);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_create\");\n" #. type: Plain text #: build/C/man3/pthread_attr_init.3:291 build/C/man3/pthread_getattr_np.3:339 #, no-wrap msgid "" " if (attrp != NULL) {\n" " s = pthread_attr_destroy(attrp);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_attr_destroy\");\n" " }\n" msgstr "" " if (attrp != NULL) {\n" " s = pthread_attr_destroy(attrp);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_attr_destroy\");\n" " }\n" #. type: Plain text #: build/C/man3/pthread_attr_init.3:294 build/C/man3/pthread_getattr_np.3:342 #, no-wrap msgid "" " pause(); /* Terminates when other thread calls exit() */\n" "}\n" msgstr "" " pause(); /* Terminates when other thread calls exit() */\n" "}\n" #. type: Plain text #: build/C/man3/pthread_attr_init.3:308 msgid "" "B(3), B(3), " "B(3), B(3), " "B(3), B(3), " "B(3), B(3), " "B(3), B(3), " "B(3), B(3), B(7)" msgstr "" "B(3), B(3), " "B(3), B(3), " "B(3), B(3), " "B(3), B(3), " "B(3), B(3), " "B(3), B(3), B(7)" #. type: TH #: build/C/man3/pthread_attr_setaffinity_np.3:24 #, no-wrap msgid "PTHREAD_ATTR_SETAFFINITY_NP" msgstr "PTHREAD_ATTR_SETAFFINITY_NP" #. type: TH #: build/C/man3/pthread_attr_setaffinity_np.3:24 #: build/C/man3/pthread_getattr_np.3:24 #: build/C/man3/pthread_setaffinity_np.3:24 #: build/C/man3/pthread_tryjoin_np.3:24 #, no-wrap msgid "2010-09-10" msgstr "2010-09-10" #. type: Plain text #: build/C/man3/pthread_attr_setaffinity_np.3:28 msgid "" "pthread_attr_setaffinity_np, pthread_attr_getaffinity_np - set/get CPU " "affinity attribute in thread attributes object" msgstr "" #. type: Plain text #: build/C/man3/pthread_attr_setaffinity_np.3:32 #: build/C/man3/pthread_getattr_np.3:31 #: build/C/man3/pthread_setaffinity_np.3:32 #: build/C/man3/pthread_tryjoin_np.3:32 #, no-wrap msgid "" "B<#define _GNU_SOURCE> /* See feature_test_macros(7) */\n" "B<#include Epthread.hE>\n" msgstr "" "B<#define _GNU_SOURCE> /* See feature_test_macros(7) */\n" "B<#include Epthread.hE>\n" #. type: Plain text #: build/C/man3/pthread_attr_setaffinity_np.3:37 #, no-wrap msgid "" "BIB<,>\n" "B< size_t >IB<, const cpu_set_t *>IB<);>\n" "BIB<,>\n" "B< size_t >IB<, cpu_set_t *>IB<);>\n" msgstr "" "BIB<,>\n" "B< size_t >IB<, const cpu_set_t *>IB<);>\n" "BIB<,>\n" "B< size_t >IB<, cpu_set_t *>IB<);>\n" #. type: Plain text #: build/C/man3/pthread_attr_setaffinity_np.3:52 msgid "" "The B() function sets the CPU affinity mask " "attribute of the thread attributes object referred to by I to the " "value specified in I. This attribute determines the CPU affinity " "mask of a thread created using the thread attributes object I." msgstr "" #. type: Plain text #: build/C/man3/pthread_attr_setaffinity_np.3:61 msgid "" "The B() function returns the CPU affinity mask " "attribute of the thread attributes object referred to by I in the " "buffer pointed to by I." msgstr "" #. type: Plain text #: build/C/man3/pthread_attr_setaffinity_np.3:68 msgid "" "The argument I is the length (in bytes) of the buffer pointed to " "by I. Typically, this argument would be specified as I." msgstr "" #. type: Plain text #: build/C/man3/pthread_attr_setaffinity_np.3:74 #: build/C/man3/pthread_setaffinity_np.3:65 msgid "" "For more details on CPU affinity masks, see B(2). For a " "description of a set of macros that can be used to manipulate and inspect " "CPU sets, see B(3)." msgstr "" #. type: TP #: build/C/man3/pthread_attr_setaffinity_np.3:78 #: build/C/man3/pthread_attr_setaffinity_np.3:90 #: build/C/man3/pthread_attr_setdetachstate.3:81 #: build/C/man3/pthread_attr_setinheritsched.3:88 #: build/C/man3/pthread_attr_setschedpolicy.3:76 #: build/C/man3/pthread_attr_setscope.3:95 #: build/C/man3/pthread_attr_setstack.3:89 #: build/C/man3/pthread_attr_setstacksize.3:65 #: build/C/man3/pthread_create.3:135 build/C/man3/pthread_detach.3:53 #: build/C/man3/pthread_join.3:83 build/C/man3/pthread_join.3:87 #: build/C/man3/pthread_kill.3:56 build/C/man3/pthread_setaffinity_np.3:82 #: build/C/man3/pthread_setaffinity_np.3:91 #: build/C/man3/pthread_setaffinity_np.3:107 #: build/C/man3/pthread_setcancelstate.3:97 #: build/C/man3/pthread_setcancelstate.3:105 #: build/C/man3/pthread_setconcurrency.3:69 #: build/C/man3/pthread_setschedparam.3:120 #: build/C/man3/pthread_setschedprio.3:60 build/C/man3/pthread_sigqueue.3:75 #, no-wrap msgid "B" msgstr "B" #. cpumask_t #. The raw sched_getaffinity() system call returns the size (in bytes) #. of the cpumask_t type. #. type: Plain text #: build/C/man3/pthread_attr_setaffinity_np.3:90 msgid "" "(B()) I specified a CPU that was " "outside the set supported by the kernel. (The kernel configuration option " "B defines the range of the set supported by the kernel data " "type used to represent CPU sets.)" msgstr "" #. type: Plain text #: build/C/man3/pthread_attr_setaffinity_np.3:100 msgid "" "(B()) A CPU in the affinity mask of the thread " "attributes object referred to by I lies outside the range specified by " "I (i.e., I/I is too small)." msgstr "" #. type: Plain text #: build/C/man3/pthread_attr_setaffinity_np.3:104 msgid "(B()) Could not allocate memory." msgstr "" #. type: Plain text #: build/C/man3/pthread_attr_setaffinity_np.3:106 #: build/C/man3/pthread_setaffinity_np.3:119 msgid "These functions are provided by glibc since version 2.3.4." msgstr "" #. type: Plain text #: build/C/man3/pthread_attr_setaffinity_np.3:109 #: build/C/man3/pthread_cleanup_push_defer_np.3:102 #: build/C/man3/pthread_setaffinity_np.3:122 #: build/C/man3/pthread_tryjoin_np.3:113 msgid "" "These functions are nonstandard GNU extensions; hence the suffix \"_np" "\" (nonportable) in the names." msgstr "" #. type: Plain text #: build/C/man3/pthread_attr_setaffinity_np.3:116 #: build/C/man3/pthread_setaffinity_np.3:148 msgid "" "In glibc 2.3.3 only, versions of these functions were provided that did not " "have a I argument. Instead the CPU set size given to the " "underlying system calls was always I." msgstr "" #. type: Plain text #: build/C/man3/pthread_attr_setaffinity_np.3:121 msgid "" "B(2), B(3), B" "(3), B(7), B(7)" msgstr "" "B(2), B(3), B" "(3), B(7), B(7)" #. type: TH #: build/C/man3/pthread_attr_setdetachstate.3:24 #, no-wrap msgid "PTHREAD_ATTR_SETDETACHSTATE" msgstr "PTHREAD_ATTR_SETDETACHSTATE" #. type: TH #: build/C/man3/pthread_attr_setdetachstate.3:24 #: build/C/man3/pthread_attr_setschedpolicy.3:24 #, no-wrap msgid "2010-02-03" msgstr "2010-02-03" #. type: Plain text #: build/C/man3/pthread_attr_setdetachstate.3:28 msgid "" "pthread_attr_setdetachstate, pthread_attr_getdetachstate - set/get detach " "state attribute in thread attributes object" msgstr "" #. type: Plain text #: build/C/man3/pthread_attr_setdetachstate.3:36 #, no-wrap msgid "" "BIB<, int >IB<);>\n" "BIB<, int *>IB<);>\n" msgstr "" "BIB<, int >IB<);>\n" "BIB<, int *>IB<);>\n" #. type: Plain text #: build/C/man3/pthread_attr_setdetachstate.3:51 msgid "" "The B() function sets the detach state " "attribute of the thread attributes object referred to by I to the " "value specified in I. The detach state attribute determines " "whether a thread created using the thread attributes object I will be " "created in a joinable or a detached state." msgstr "" #. type: Plain text #: build/C/man3/pthread_attr_setdetachstate.3:54 msgid "The following values may be specified in I:" msgstr "" #. type: TP #: build/C/man3/pthread_attr_setdetachstate.3:54 #, no-wrap msgid "B" msgstr "B" #. type: Plain text #: build/C/man3/pthread_attr_setdetachstate.3:59 msgid "" "Threads that are created using I will be created in a detached state." msgstr "" #. type: TP #: build/C/man3/pthread_attr_setdetachstate.3:59 #, no-wrap msgid "B" msgstr "B" #. type: Plain text #: build/C/man3/pthread_attr_setdetachstate.3:64 msgid "" "Threads that are created using I will be created in a joinable state." msgstr "" #. type: Plain text #: build/C/man3/pthread_attr_setdetachstate.3:68 msgid "" "The default setting of the detach state attribute in a newly initialized " "thread attributes object is B." msgstr "" #. type: Plain text #: build/C/man3/pthread_attr_setdetachstate.3:75 msgid "" "The B() returns the detach state attribute of " "the thread attributes object I in the buffer pointed to by " "I." msgstr "" #. type: Plain text #: build/C/man3/pthread_attr_setdetachstate.3:81 msgid "B() can fail with the following error:" msgstr "" #. type: Plain text #: build/C/man3/pthread_attr_setdetachstate.3:85 msgid "An invalid value was specified in I." msgstr "" #. type: Plain text #: build/C/man3/pthread_attr_setdetachstate.3:91 msgid "" "See B(3) for more details on detached and joinable threads." msgstr "" #. type: Plain text #: build/C/man3/pthread_attr_setdetachstate.3:99 msgid "" "A thread that is created in a joinable state should eventually either be " "joined using B(3) or detached using B(3); see " "B(3)." msgstr "" #. type: Plain text #: build/C/man3/pthread_attr_setdetachstate.3:106 msgid "" "It is an error to specify the thread ID of a thread that was created in a " "detached state in a later call to B(3) or B" "(3)." msgstr "" #. type: Plain text #: build/C/man3/pthread_attr_setdetachstate.3:109 #: build/C/man3/pthread_attr_setstack.3:154 msgid "See B(3)." msgstr "" #. type: Plain text #: build/C/man3/pthread_attr_setdetachstate.3:114 msgid "" "B(3), B(3), B(3), " "B(3), B(7)" msgstr "" "B(3), B(3), B(3), " "B(3), B(7)" #. type: TH #: build/C/man3/pthread_attr_setguardsize.3:24 #, no-wrap msgid "PTHREAD_ATTR_SETGUARDSIZE" msgstr "PTHREAD_ATTR_SETGUARDSIZE" #. type: TH #: build/C/man3/pthread_attr_setguardsize.3:24 #: build/C/man3/pthread_attr_setscope.3:24 #: build/C/man3/pthread_attr_setstack.3:24 #: build/C/man3/pthread_attr_setstackaddr.3:24 build/C/man3/pthread_self.3:24 #, no-wrap msgid "2008-10-24" msgstr "2008-10-24" #. type: Plain text #: build/C/man3/pthread_attr_setguardsize.3:28 msgid "" "pthread_attr_setguardsize, pthread_attr_getguardsize - set/get guard size " "attribute in thread attributes object" msgstr "" #. type: Plain text #: build/C/man3/pthread_attr_setguardsize.3:36 #, no-wrap msgid "" "BIB<, size_t >IB<);>\n" "BIB<, size_t *>IB<);>\n" msgstr "" "BIB<, size_t >IB<);>\n" "BIB<, size_t *>IB<);>\n" #. type: Plain text #: build/C/man3/pthread_attr_setguardsize.3:47 msgid "" "The B() function sets the guard size attribute " "of the thread attributes object referred to by I to the value " "specified in I." msgstr "" #. type: Plain text #: build/C/man3/pthread_attr_setguardsize.3:57 msgid "" "If I is greater than 0, then for each new thread created using " "I the system allocates an additional region of at least I " "bytes at the end of the thread's stack to act as the guard area for the " "stack (but see BUGS)." msgstr "" #. type: Plain text #: build/C/man3/pthread_attr_setguardsize.3:63 msgid "" "If I is 0, then new threads created with I will not have a " "guard area." msgstr "" #. type: Plain text #: build/C/man3/pthread_attr_setguardsize.3:65 msgid "The default guard size is the same as the system page size." msgstr "" #. type: Plain text #: build/C/man3/pthread_attr_setguardsize.3:80 msgid "" "If the stack address attribute has been set in I (using " "B(3) or B(3)), meaning " "that the caller is allocating the thread's stack, then the guard size " "attribute is ignored (i.e., no guard area is created by the system): it is " "the application's responsibility to handle stack overflow (perhaps by using " "B(2) to manually define a guard area at the end of the stack that " "it has allocated)." msgstr "" #. type: Plain text #: build/C/man3/pthread_attr_setguardsize.3:88 msgid "" "The B() function returns the guard size " "attribute of the thread attributes object referred to by I in the " "buffer pointed to by I." msgstr "" #. type: Plain text #: build/C/man3/pthread_attr_setguardsize.3:102 msgid "" "POSIX.1-2001 documents an B error if I or I is " "invalid. On Linux these functions always succeed (but portable and future-" "proof applications should nevertheless handle a possible error return)." msgstr "" #. type: Plain text #: build/C/man3/pthread_attr_setguardsize.3:104 #: build/C/man3/pthread_attr_setstackaddr.3:81 #: build/C/man3/pthread_attr_setstacksize.3:81 msgid "These functions are provided by glibc since version 2.1." msgstr "" #. type: Plain text #: build/C/man3/pthread_attr_setguardsize.3:120 msgid "" "A guard area consists of virtual memory pages that are protected to prevent " "read and write access. If a thread overflows its stack into the guard area, " "then, on most hard architectures, it receives a B signal, thus " "notifying it of the overflow. Guard areas start on page boundaries, and the " "guard size is internally rounded up to the system page size when creating a " "thread. (Nevertheless, B() returns the guard " "size that was set by B().)" msgstr "" #. type: Plain text #: build/C/man3/pthread_attr_setguardsize.3:124 msgid "" "Setting a guard size of 0 may be useful to save memory in an application " "that creates many threads and knows that stack overflow can never occur." msgstr "" #. type: Plain text #: build/C/man3/pthread_attr_setguardsize.3:128 msgid "" "Choosing a guard size larger than the default size may be necessary for " "detecting stack overflows if a thread allocates large data structures on the " "stack." msgstr "" #. type: SH #: build/C/man3/pthread_attr_setguardsize.3:128 #: build/C/man3/pthread_attr_setinheritsched.3:101 #: build/C/man3/pthread_attr_setstacksize.3:94 #: build/C/man3/pthread_create.3:194 build/C/man3/pthread_exit.3:91 #, no-wrap msgid "BUGS" msgstr "バグ" #. type: Plain text #: build/C/man3/pthread_attr_setguardsize.3:139 msgid "" "As at glibc 2.8, the NPTL threading implementation includes the guard area " "within the stack size allocation, rather than allocating extra space at the " "end of the stack, as POSIX.1 requires. (This can result in an B " "error from B(3) if the guard size value is too large, " "leaving no space for the actual stack.)" msgstr "" #. glibc includes the guardsize within the allocated stack size, #. which looks pretty clearly to be in violation of POSIX. #. Filed bug, 22 Oct 2008: #. http://sources.redhat.com/bugzilla/show_bug.cgi?id=6973 #. Older reports: #. https//bugzilla.redhat.com/show_bug.cgi?id=435337 #. Reportedly, LinuxThreads did the right thing, allocating #. extra space at the end of the stack: #. http://sourceware.org/ml/libc-alpha/2008-05/msg00086.html #. type: Plain text #: build/C/man3/pthread_attr_setguardsize.3:153 msgid "" "The obsolete LinuxThreads implementation did the right thing, allocating " "extra space at the end of the stack for the guard area." msgstr "" #. type: Plain text #: build/C/man3/pthread_attr_setguardsize.3:156 msgid "See B(3)." msgstr "" #. type: Plain text #: build/C/man3/pthread_attr_setguardsize.3:163 msgid "" "B(2), B(2), B(3), B" "(3), B(3), B(3), B(7)" msgstr "" "B(2), B(2), B(3), B" "(3), B(3), B(3), B(7)" #. type: TH #: build/C/man3/pthread_attr_setinheritsched.3:24 #, no-wrap msgid "PTHREAD_ATTR_SETINHERITSCHED" msgstr "PTHREAD_ATTR_SETINHERITSCHED" #. type: TH #: build/C/man3/pthread_attr_setinheritsched.3:24 #: build/C/man3/pthread_attr_setschedparam.3:24 #: build/C/man3/pthread_attr_setstacksize.3:24 #: build/C/man3/pthread_create.3:24 #, no-wrap msgid "2012-03-15" msgstr "2012-03-15" #. type: Plain text #: build/C/man3/pthread_attr_setinheritsched.3:28 msgid "" "pthread_attr_setinheritsched, pthread_attr_getinheritsched - set/get inherit " "scheduler attribute in thread attributes object" msgstr "" #. type: Plain text #: build/C/man3/pthread_attr_setinheritsched.3:36 #, no-wrap msgid "" "BIB<,>\n" "B< int >IB<);>\n" "BIB<,>\n" "B< int *>IB<);>\n" msgstr "" "BIB<,>\n" "B< int >IB<);>\n" "BIB<,>\n" "B< int *>IB<);>\n" #. type: Plain text #: build/C/man3/pthread_attr_setinheritsched.3:53 msgid "" "The B() function sets the inherit scheduler " "attribute of the thread attributes object referred to by I to the " "value specified in I. The inherit scheduler attribute " "determines whether a thread created using the thread attributes object " "I will inherit its scheduling attributes from the calling thread or " "whether it will take them from I." msgstr "" #. type: Plain text #: build/C/man3/pthread_attr_setinheritsched.3:56 msgid "The following values may be specified in I:" msgstr "" #. type: TP #: build/C/man3/pthread_attr_setinheritsched.3:56 #, no-wrap msgid "B" msgstr "B" #. type: Plain text #: build/C/man3/pthread_attr_setinheritsched.3:64 msgid "" "Threads that are created using I inherit scheduling attributes from " "the creating thread; the scheduling attributes in I are ignored." msgstr "" #. type: TP #: build/C/man3/pthread_attr_setinheritsched.3:64 #, no-wrap msgid "B" msgstr "B" #. FIXME what are the defaults for scheduler settings? #. type: Plain text #: build/C/man3/pthread_attr_setinheritsched.3:71 msgid "" "Threads that are created using I take their scheduling attributes from " "the values specified by the attributes object." msgstr "" #. type: Plain text #: build/C/man3/pthread_attr_setinheritsched.3:75 msgid "" "The default setting of the inherit scheduler attribute in a newly " "initialized thread attributes object is B." msgstr "" #. type: Plain text #: build/C/man3/pthread_attr_setinheritsched.3:82 msgid "" "The B() returns the inherit scheduler " "attribute of the thread attributes object I in the buffer pointed to " "by I." msgstr "" #. type: Plain text #: build/C/man3/pthread_attr_setinheritsched.3:88 msgid "B() can fail with the following error:" msgstr "" #. type: Plain text #: build/C/man3/pthread_attr_setinheritsched.3:92 msgid "Invalid value in I." msgstr "" #. .SH VERSIONS #. Available since glibc 2.0. #. type: Plain text #: build/C/man3/pthread_attr_setinheritsched.3:99 msgid "" "POSIX.1-2001 also documents an optional B error (\"attempt was made " "to set the attribute to an unsupported value\") for " "B()." msgstr "" #. FIXME . Track status of the following bug: #. http://sourceware.org/bugzilla/show_bug.cgi?id=7007 #. type: Plain text #: build/C/man3/pthread_attr_setinheritsched.3:117 msgid "" "As at glibc 2.8, if a thread attributes object is initialized using " "B(3), then the scheduling policy of the attributes object " "is set to B and the scheduling priority is set to 0. However, " "if the inherit scheduler attribute is then set to B, " "then a thread created using the attribute object wrongly inherits its " "scheduling attributes from the creating thread. This bug does not occur if " "either the scheduling policy or scheduling priority attribute is explicitly " "set in the thread attributes object before calling B(3)." msgstr "" #. type: Plain text #: build/C/man3/pthread_attr_setinheritsched.3:120 #: build/C/man3/pthread_attr_setschedparam.3:96 #: build/C/man3/pthread_attr_setschedpolicy.3:92 msgid "See B(3)." msgstr "" #. type: Plain text #: build/C/man3/pthread_attr_setinheritsched.3:128 msgid "" "B(2), B(3), " "B(3), B(3), " "B(3), B(3), B" "(3), B(7)" msgstr "" "B(2), B(3), " "B(3), B(3), " "B(3), B(3), B" "(3), B(7)" #. type: TH #: build/C/man3/pthread_attr_setschedparam.3:24 #, no-wrap msgid "PTHREAD_ATTR_SETSCHEDPARAM" msgstr "PTHREAD_ATTR_SETSCHEDPARAM" #. type: Plain text #: build/C/man3/pthread_attr_setschedparam.3:28 msgid "" "pthread_attr_setschedparam, pthread_attr_getschedparam - set/get scheduling " "parameter attributes in thread attributes object" msgstr "" #. type: Plain text #: build/C/man3/pthread_attr_setschedparam.3:36 #, no-wrap msgid "" "BIB<,>\n" "B< const struct sched_param *>IB<);>\n" "BIB<,>\n" "B< struct sched_param *>IB<);>\n" msgstr "" "BIB<,>\n" "B< const struct sched_param *>IB<);>\n" "BIB<,>\n" "B< struct sched_param *>IB<);>\n" #. type: Plain text #: build/C/man3/pthread_attr_setschedparam.3:50 msgid "" "The B() function sets the scheduling parameter " "attributes of the thread attributes object referred to by I to the " "values specified in the buffer pointed to by I. These attributes " "determine the scheduling parameters of a thread created using the thread " "attributes object I." msgstr "" #. type: Plain text #: build/C/man3/pthread_attr_setschedparam.3:57 msgid "" "The B() returns the scheduling parameter " "attributes of the thread attributes object I in the buffer pointed to " "by I." msgstr "" #. type: Plain text #: build/C/man3/pthread_attr_setschedparam.3:59 msgid "Scheduling parameters are maintained in the following structure:" msgstr "" #. type: Plain text #: build/C/man3/pthread_attr_setschedparam.3:65 #: build/C/man3/pthread_setschedparam.3:67 #, no-wrap msgid "" "struct sched_param {\n" " int sched_priority; /* Scheduling priority */\n" "};\n" msgstr "" "struct sched_param {\n" " int sched_priority; /* Scheduling priority */\n" "};\n" #. type: Plain text #: build/C/man3/pthread_attr_setschedparam.3:72 #: build/C/man3/pthread_setschedparam.3:74 msgid "" "As can be seen, only one scheduling parameter is supported. For details of " "the permitted ranges for scheduling priorities in each scheduling policy, " "see B(2)." msgstr "" #. .SH VERSIONS #. Available since glibc 2.0. #. type: Plain text #: build/C/man3/pthread_attr_setschedparam.3:87 msgid "" "POSIX.1 documents B and B errors for " "B(). On Linux these functions always succeed " "(but portable and future-proof applications should nevertheless handle a " "possible error return)." msgstr "" #. type: Plain text #: build/C/man3/pthread_attr_setschedparam.3:93 msgid "" "See B(3) for a list of the thread scheduling " "policies supported on Linux." msgstr "" #. type: Plain text #: build/C/man3/pthread_attr_setschedparam.3:105 msgid "" "B(2), B(2), B" "(3), B(3), B(3), " "B(3), B(3), B" "(3), B(7)" msgstr "" "B(2), B(2), B" "(3), B(3), B(3), " "B(3), B(3), B" "(3), B(7)" #. type: TH #: build/C/man3/pthread_attr_setschedpolicy.3:24 #, no-wrap msgid "PTHREAD_ATTR_SETSCHEDPOLICY" msgstr "PTHREAD_ATTR_SETSCHEDPOLICY" #. type: Plain text #: build/C/man3/pthread_attr_setschedpolicy.3:28 msgid "" "pthread_attr_setschedpolicy, pthread_attr_getschedpolicy - set/get " "scheduling policy attribute in thread attributes object" msgstr "" #. type: Plain text #: build/C/man3/pthread_attr_setschedpolicy.3:36 #, no-wrap msgid "" "BIB<, int >IB<);>\n" "BIB<, int >I<*policy>B<);>\n" msgstr "" "BIB<, int >IB<);>\n" "BIB<, int >I<*policy>B<);>\n" #. type: Plain text #: build/C/man3/pthread_attr_setschedpolicy.3:50 msgid "" "The B() function sets the scheduling policy " "attribute of the thread attributes object referred to by I to the " "value specified in I. This attribute determines the scheduling " "policy of a thread created using the thread attributes object I." msgstr "" #. FIXME . pthread_setschedparam() places no restriction on the policy, #. but pthread_attr_setschedpolicy() restricts policy to RR/FIFO/OTHER #. http://sourceware.org/bugzilla/show_bug.cgi?id=7013 #. type: Plain text #: build/C/man3/pthread_attr_setschedpolicy.3:63 msgid "" "The supported values for I are B, B, and " "B, with the semantics described in B(2)." msgstr "" #. type: Plain text #: build/C/man3/pthread_attr_setschedpolicy.3:70 msgid "" "The B() returns the scheduling policy " "attribute of the thread attributes object I in the buffer pointed to " "by I." msgstr "" #. type: Plain text #: build/C/man3/pthread_attr_setschedpolicy.3:76 msgid "B() can fail with the following error:" msgstr "" #. type: Plain text #: build/C/man3/pthread_attr_setschedpolicy.3:80 msgid "Invalid value in I." msgstr "" #. .SH VERSIONS #. Available since glibc 2.0. #. type: Plain text #: build/C/man3/pthread_attr_setschedpolicy.3:87 msgid "" "POSIX.1-2001 also documents an optional B error (\"attempt was made " "to set the attribute to an unsupported value\") for " "B()." msgstr "" #. type: Plain text #: build/C/man3/pthread_attr_setschedpolicy.3:100 msgid "" "B(2), B(3), " "B(3), B(3), " "B(3), B(3), B" "(3), B(7)" msgstr "" "B(2), B(3), " "B(3), B(3), " "B(3), B(3), B" "(3), B(7)" #. type: TH #: build/C/man3/pthread_attr_setscope.3:24 #, no-wrap msgid "PTHREAD_ATTR_SETSCOPE" msgstr "PTHREAD_ATTR_SETSCOPE" #. type: Plain text #: build/C/man3/pthread_attr_setscope.3:28 msgid "" "pthread_attr_setscope, pthread_attr_getscope - set/get contention scope " "attribute in thread attributes object" msgstr "" #. type: Plain text #: build/C/man3/pthread_attr_setscope.3:36 #, no-wrap msgid "" "BIB<, int >IB<);>\n" "BIB<, int *>IB<);>\n" msgstr "" "BIB<, int >IB<);>\n" "BIB<, int *>IB<);>\n" #. type: Plain text #: build/C/man3/pthread_attr_setscope.3:51 msgid "" "The B() function sets the contention scope attribute " "of the thread attributes object referred to by I to the value " "specified in I. The contention scope attribute defines the set of " "threads against which a thread competes for resources such as the CPU. " "POSIX.1-2001 specifies two possible values for I:" msgstr "" #. type: TP #: build/C/man3/pthread_attr_setscope.3:51 #, no-wrap msgid "B" msgstr "B" #. type: Plain text #: build/C/man3/pthread_attr_setscope.3:59 msgid "" "The thread competes for resources with all other threads in all processes on " "the system that are in the same scheduling allocation domain (a group of one " "or more processors). B threads are scheduled relative " "to one another according to their scheduling policy and priority." msgstr "" #. type: TP #: build/C/man3/pthread_attr_setscope.3:59 #, no-wrap msgid "B" msgstr "B" #. type: Plain text #: build/C/man3/pthread_attr_setscope.3:74 msgid "" "The thread competes for resources with all other threads in the same process " "that were also created with the B contention scope. " "B threads are scheduled relative to other threads in " "the process according to their scheduling policy and priority. POSIX.1-2001 " "leaves it unspecified how these threads contend with other threads in other " "process on the system or with other threads in the same process that were " "created with the B contention scope." msgstr "" #. type: Plain text #: build/C/man3/pthread_attr_setscope.3:81 msgid "" "POSIX.1-2001 only requires that an implementation support one of these " "contention scopes, but permits both to be supported. Linux supports " "B, but not B." msgstr "" #. type: Plain text #: build/C/man3/pthread_attr_setscope.3:89 msgid "" "The B() function returns the contention scope " "attribute of the thread attributes object referred to by I in the " "buffer pointed to by I." msgstr "" #. type: Plain text #: build/C/man3/pthread_attr_setscope.3:95 msgid "B() can fail with the following errors:" msgstr "" #. type: Plain text #: build/C/man3/pthread_attr_setscope.3:99 msgid "An invalid value was specified in I." msgstr "" #. type: TP #: build/C/man3/pthread_attr_setscope.3:99 #, no-wrap msgid "B" msgstr "B" #. type: Plain text #: build/C/man3/pthread_attr_setscope.3:105 msgid "" "I specified the value B, which is not " "supported on Linux." msgstr "" #. type: Plain text #: build/C/man3/pthread_attr_setscope.3:115 msgid "" "The B contention scope typically indicates that a " "userspace thread is bound directly to a single kernel-scheduling entity. " "This is the case on Linux for the obsolete LinuxThreads implementation and " "the modern NPTL implementation, which are both 1:1 threading implementations." msgstr "" #. type: Plain text #: build/C/man3/pthread_attr_setscope.3:118 msgid "" "POSIX.1-2001 specifies that the default contention scope is implementation-" "defined." msgstr "" #. type: Plain text #: build/C/man3/pthread_attr_setscope.3:125 msgid "" "B(3), B(3), " "B(3), B(3), " "B(3), B(3), B(7)" msgstr "" "B(3), B(3), " "B(3), B(3), " "B(3), B(3), B(7)" #. type: TH #: build/C/man3/pthread_attr_setstack.3:24 #, no-wrap msgid "PTHREAD_ATTR_SETSTACK" msgstr "PTHREAD_ATTR_SETSTACK" #. type: Plain text #: build/C/man3/pthread_attr_setstack.3:28 msgid "" "pthread_attr_setstack, pthread_attr_getstack - set/get stack attributes in " "thread attributes object" msgstr "" #. type: Plain text #: build/C/man3/pthread_attr_setstack.3:36 #, no-wrap msgid "" "BIB<,>\n" "B< void *>IB<, size_t >IB<);>\n" "BIB<,>\n" "B< void **>IB<, size_t *>IB<);>\n" msgstr "" "BIB<,>\n" "B< void *>IB<, size_t >IB<);>\n" "BIB<,>\n" "B< void **>IB<, size_t *>IB<);>\n" #. type: Plain text #: build/C/man3/pthread_attr_setstack.3:43 build/C/man3/pthread_sigqueue.3:39 msgid "" "Feature Test Macro Requirements for glibc (see B(7)):" msgstr "" #. type: Plain text #: build/C/man3/pthread_attr_setstack.3:48 msgid "B(), B():" msgstr "B(), B():" #. type: Plain text #: build/C/man3/pthread_attr_setstack.3:50 msgid "_POSIX_C_SOURCE\\ E=\\ 200112L || _XOPEN_SOURCE\\ E=\\ 600" msgstr "_POSIX_C_SOURCE\\ E=\\ 200112L || _XOPEN_SOURCE\\ E=\\ 600" #. type: Plain text #: build/C/man3/pthread_attr_setstack.3:66 msgid "" "The B() function sets the stack address and stack " "size attributes of the thread attributes object referred to by I to " "the values specified in I and I, respectively. These " "attributes specify the location and size of the stack that should be used by " "a thread that is created using the thread attributes object I." msgstr "" #. type: Plain text #: build/C/man3/pthread_attr_setstack.3:72 msgid "" "I should point to the lowest addressable byte of a buffer of " "I bytes that was allocated by the caller. The pages of the " "allocated buffer should be both readable and writable." msgstr "" #. type: Plain text #: build/C/man3/pthread_attr_setstack.3:83 msgid "" "The B() function returns the stack address and stack " "size attributes of the thread attributes object referred to by I in " "the buffers pointed to by I and I, respectively." msgstr "" #. type: Plain text #: build/C/man3/pthread_attr_setstack.3:89 msgid "B() can fail with the following error:" msgstr "" #. type: Plain text #: build/C/man3/pthread_attr_setstack.3:100 msgid "" "I is less than B (16384) bytes. On some " "systems, this error may also occur if I or I is not suitably aligned." msgstr "" #. type: Plain text #: build/C/man3/pthread_attr_setstack.3:108 msgid "" "POSIX.1-2001 also documents an B error if the stack area described " "by I and I is not both readable and writable by the " "caller." msgstr "" #. type: Plain text #: build/C/man3/pthread_attr_setstack.3:110 msgid "These functions are provided by glibc since version 2.2." msgstr "" #. type: Plain text #: build/C/man3/pthread_attr_setstack.3:120 msgid "" "These functions are provided for applications that must ensure that a " "thread's stack is placed in a particular location. For most applications, " "this is not necessary, and the use of these functions should be avoided. " "(Use B(3) if an application simply requires a " "stack size other than the default.)" msgstr "" #. type: Plain text #: build/C/man3/pthread_attr_setstack.3:131 msgid "" "When an application employs B(), it takes over the " "responsibility of allocating the stack. Any guard size value that was set " "using B(3) is ignored. If deemed necessary, it " "is the application's responsibility to allocate a guard area (one or more " "pages protected against reading and writing) to handle the possibility of " "stack overflow." msgstr "" #. type: Plain text #: build/C/man3/pthread_attr_setstack.3:142 msgid "" "The address specified in I should be suitably aligned: for full " "portability, align it on a page boundary (I). " "B(3) may be useful for allocation. Probably, I " "should also be a multiple of the system page size." msgstr "" #. type: Plain text #: build/C/man3/pthread_attr_setstack.3:151 msgid "" "If I is used to create multiple threads, then the caller must change " "the stack address attribute between calls to B(3); " "otherwise, the threads will attempt to use the same memory area for their " "stacks, and chaos will ensue." msgstr "" #. type: Plain text #: build/C/man3/pthread_attr_setstack.3:163 msgid "" "B(2), B(2), B(3), B(3), " "B(3), B(3), " "B(3), B(3), B(7)" msgstr "" "B(2), B(2), B(3), B(3), " "B(3), B(3), " "B(3), B(3), B(7)" #. type: TH #: build/C/man3/pthread_attr_setstackaddr.3:24 #, no-wrap msgid "PTHREAD_ATTR_SETSTACKADDR" msgstr "PTHREAD_ATTR_SETSTACKADDR" #. type: Plain text #: build/C/man3/pthread_attr_setstackaddr.3:28 msgid "" "pthread_attr_setstackaddr, pthread_attr_getstackaddr - set/get stack address " "attribute in thread attributes object" msgstr "" #. type: Plain text #: build/C/man3/pthread_attr_setstackaddr.3:36 #, no-wrap msgid "" "BIB<, void *>IB<);>\n" "BIB<, void **>IB<);>\n" msgstr "" "BIB<, void *>IB<);>\n" "BIB<, void **>IB<);>\n" #. type: Plain text #: build/C/man3/pthread_attr_setstackaddr.3:47 msgid "" "These functions are obsolete: B Use " "B(3) and B(3) instead." msgstr "" #. type: Plain text #: build/C/man3/pthread_attr_setstackaddr.3:58 msgid "" "The B() function sets the stack address " "attribute of the thread attributes object referred to by I to the " "value specified in I. This attribute specifies the location of " "the stack that should be used by a thread that is created using the thread " "attributes object I." msgstr "" #. type: Plain text #: build/C/man3/pthread_attr_setstackaddr.3:64 msgid "" "I should point to a buffer of at least B bytes " "that was allocated by the caller. The pages of the allocated buffer should " "be both readable and writable." msgstr "" #. type: Plain text #: build/C/man3/pthread_attr_setstackaddr.3:72 msgid "" "The B() function returns the stack address " "attribute of the thread attributes object referred to by I in the " "buffer pointed to by I." msgstr "" #. type: Plain text #: build/C/man3/pthread_attr_setstackaddr.3:79 msgid "" "No errors are defined (but applications should nevertheless handle a " "possible error return)." msgstr "" #. type: Plain text #: build/C/man3/pthread_attr_setstackaddr.3:84 msgid "" "POSIX.1-2001 specifies these functions but marks them as obsolete. " "POSIX.1-2008 removes the specification of these functions." msgstr "" #. type: Plain text #: build/C/man3/pthread_attr_setstackaddr.3:108 msgid "" "I They cannot be portably used, since they " "provide no way of specifying the direction of growth or the range of the " "stack. For example, on architectures with a stack that grows downward, " "I specifies the next address past the I address of the " "allocated stack area. However, on architectures with a stack that grows " "upward, I specifies the I address in the allocated stack " "area. By contrast, the I used by B(3) " "and B(3), is always a pointer to the lowest address " "in the allocated stack area (and the I argument specifies the " "range of the stack)." msgstr "" #. type: Plain text #: build/C/man3/pthread_attr_setstackaddr.3:113 msgid "" "B(3), B(3), " "B(3), B(3), B(7)" msgstr "" "B(3), B(3), " "B(3), B(3), B(7)" #. type: TH #: build/C/man3/pthread_attr_setstacksize.3:24 #, no-wrap msgid "PTHREAD_ATTR_SETSTACKSIZE" msgstr "PTHREAD_ATTR_SETSTACKSIZE" #. type: Plain text #: build/C/man3/pthread_attr_setstacksize.3:28 msgid "" "pthread_attr_setstacksize, pthread_attr_getstacksize - set/get stack size " "attribute in thread attributes object" msgstr "" #. type: Plain text #: build/C/man3/pthread_attr_setstacksize.3:36 #, no-wrap msgid "" "BIB<, size_t >IB<);>\n" "BIB<, size_t *>IB<);>\n" msgstr "" "BIB<, size_t >IB<);>\n" "BIB<, size_t *>IB<);>\n" #. type: Plain text #: build/C/man3/pthread_attr_setstacksize.3:47 msgid "" "The B() function sets the stack size attribute " "of the thread attributes object referred to by I to the value " "specified in I." msgstr "" #. type: Plain text #: build/C/man3/pthread_attr_setstacksize.3:51 msgid "" "The stack size attribute determines the minimum size (in bytes) that will be " "allocated for threads created using the thread attributes object I." msgstr "" #. type: Plain text #: build/C/man3/pthread_attr_setstacksize.3:59 msgid "" "The B() function returns the stack size " "attribute of the thread attributes object referred to by I in the " "buffer pointed to by I." msgstr "" #. type: Plain text #: build/C/man3/pthread_attr_setstacksize.3:65 msgid "B() can fail with the following error:" msgstr "" #. type: Plain text #: build/C/man3/pthread_attr_setstacksize.3:70 msgid "The stack size is less than B (16384) bytes." msgstr "" #. e.g., MacOS #. type: Plain text #: build/C/man3/pthread_attr_setstacksize.3:79 msgid "" "On some systems, B() can fail with the error " "B if I is not a multiple of the system page size." msgstr "" #. type: Plain text #: build/C/man3/pthread_attr_setstacksize.3:86 msgid "" "For details on the default stack size of new threads, see B" "(3)." msgstr "" #. type: Plain text #: build/C/man3/pthread_attr_setstacksize.3:89 msgid "" "A thread's stack size is fixed at the time of thread creation. Only the " "main thread can dynamically grow its stack." msgstr "" #. type: Plain text #: build/C/man3/pthread_attr_setstacksize.3:94 msgid "" "The B(3) function allows an application to set both " "the size and location of a caller-allocated stack that is to be used by a " "thread." msgstr "" #. type: Plain text #: build/C/man3/pthread_attr_setstacksize.3:106 msgid "" "As at glibc 2.8, if the specified I is not a multiple of " "B (16 bytes on most architectures), it may be rounded " "I, in violation of POSIX.1-2001, which says that the allocated " "stack will be at least I bytes." msgstr "" #. type: Plain text #: build/C/man3/pthread_attr_setstacksize.3:109 #: build/C/man3/pthread_join.3:125 msgid "See B(3)." msgstr "" #. type: Plain text #: build/C/man3/pthread_attr_setstacksize.3:115 msgid "" "B(2), B(3), B(3), " "B(3), B(3), B(7)" msgstr "" "B(2), B(3), B(3), " "B(3), B(3), B(7)" #. type: TH #: build/C/man3/pthread_cancel.3:24 #, no-wrap msgid "PTHREAD_CANCEL" msgstr "PTHREAD_CANCEL" #. type: TH #: build/C/man3/pthread_cancel.3:24 build/C/man3/pthread_setschedparam.3:24 #, no-wrap msgid "2008-11-17" msgstr "2008-11-17" #. type: Plain text #: build/C/man3/pthread_cancel.3:27 msgid "pthread_cancel - send a cancellation request to a thread" msgstr "" #. type: Plain text #: build/C/man3/pthread_cancel.3:32 #, no-wrap msgid "BIB<);>\n" msgstr "BIB<);>\n" #. type: Plain text #: build/C/man3/pthread_cancel.3:44 msgid "" "The B() function sends a cancellation request to the thread " "I. Whether and when the target thread reacts to the cancellation " "request depends on two attributes that are under the control of that thread: " "its cancelability I and I." msgstr "" #. type: Plain text #: build/C/man3/pthread_cancel.3:56 msgid "" "A thread's cancelability state, determined by B(3), " "can be I (the default for new threads) or I. If a thread " "has disabled cancellation, then a cancellation request remains queued until " "the thread enables cancellation. If a thread has enabled cancellation, then " "its cancelability type determines when cancellation occurs." msgstr "" #. type: Plain text #: build/C/man3/pthread_cancel.3:72 msgid "" "A thread's cancellation type, determined by B(3), may " "be either I or I (the default for new threads). " "Asynchronous cancelability means that the thread can be canceled at any time " "(usually immediately, but the system does not guarantee this). Deferred " "cancelability means that cancellation will be delayed until the thread next " "calls a function that is a I. A list of functions that " "are or may be cancellation points is provided in I(7)." msgstr "" #. type: Plain text #: build/C/man3/pthread_cancel.3:76 msgid "" "When a cancellation requested is acted on, the following steps occur for " "I (in this order):" msgstr "" #. type: IP #: build/C/man3/pthread_cancel.3:76 build/C/man3/pthread_cleanup_push.3:67 #, no-wrap msgid "1." msgstr "1." #. type: Plain text #: build/C/man3/pthread_cancel.3:81 msgid "" "Cancellation clean-up handlers are popped (in the reverse of the order in " "which they were pushed) and called. (See B(3).)" msgstr "" #. type: IP #: build/C/man3/pthread_cancel.3:81 build/C/man3/pthread_cleanup_push.3:71 #, no-wrap msgid "2." msgstr "2." #. type: Plain text #: build/C/man3/pthread_cancel.3:86 msgid "" "Thread-specific data destructors are called, in an unspecified order. (See " "B(3).)" msgstr "" #. type: IP #: build/C/man3/pthread_cancel.3:86 build/C/man3/pthread_cleanup_push.3:79 #, no-wrap msgid "3." msgstr "3." #. type: Plain text #: build/C/man3/pthread_cancel.3:90 msgid "The thread is terminated. (See B(3).)" msgstr "" #. type: Plain text #: build/C/man3/pthread_cancel.3:98 msgid "" "The above steps happen asynchronously with respect to the B" "() call; the return status of B() merely informs the " "caller whether the cancellation request was successfully queued." msgstr "" #. type: Plain text #: build/C/man3/pthread_cancel.3:107 msgid "" "After a canceled thread has terminated, a join with that thread using " "B(3) obtains B as the thread's exit " "status. (Joining with a thread is the only way to know that cancellation " "has completed.)" msgstr "" #. type: Plain text #: build/C/man3/pthread_cancel.3:112 msgid "" "On success, B() returns 0; on error, it returns a nonzero " "error number." msgstr "" #. type: TP #: build/C/man3/pthread_cancel.3:113 build/C/man3/pthread_detach.3:57 #: build/C/man3/pthread_getcpuclockid.3:56 build/C/man3/pthread_join.3:91 #: build/C/man3/pthread_kill.3:59 build/C/man3/pthread_setaffinity_np.3:112 #: build/C/man3/pthread_setschedparam.3:112 #: build/C/man3/pthread_setschedprio.3:68 build/C/man3/pthread_sigqueue.3:83 #, no-wrap msgid "B" msgstr "B" #. type: Plain text #: build/C/man3/pthread_cancel.3:120 build/C/man3/pthread_detach.3:62 #: build/C/man3/pthread_getcpuclockid.3:61 build/C/man3/pthread_join.3:96 #: build/C/man3/pthread_kill.3:64 build/C/man3/pthread_setaffinity_np.3:117 #: build/C/man3/pthread_setschedparam.3:117 #: build/C/man3/pthread_setschedprio.3:73 msgid "No thread with the ID I could be found." msgstr "" #. type: Plain text #: build/C/man3/pthread_cancel.3:130 msgid "" "On Linux, cancellation is implemented using signals. Under the NPTL " "threading implementation, the first real-time signal (i.e., signal 32) is " "used for this purpose. On LinuxThreads, the second real-time signal is " "used, if real-time signals are available, otherwise B is used." msgstr "" #. type: Plain text #: build/C/man3/pthread_cancel.3:136 msgid "" "The program below creates a thread and then cancels it. The main thread " "joins with the canceled thread to check that its exit status was " "B. The following shell session shows what happens when we " "run the program:" msgstr "" #. type: Plain text #: build/C/man3/pthread_cancel.3:144 #, no-wrap msgid "" "$ ./a.out\n" "thread_func(): started; cancellation disabled\n" "main(): sending cancellation request\n" "thread_func(): about to enable cancellation\n" "main(): thread was canceled\n" msgstr "" "$ ./a.out\n" "thread_func(): started; cancellation disabled\n" "main(): sending cancellation request\n" "thread_func(): about to enable cancellation\n" "main(): thread was canceled\n" #. type: Plain text #: build/C/man3/pthread_cancel.3:154 #, no-wrap msgid "" "#include Epthread.hE\n" "#include Estdio.hE\n" "#include Eerrno.hE\n" "#include Estdlib.hE\n" "#include Eunistd.hE\n" msgstr "" "#include Epthread.hE\n" "#include Estdio.hE\n" "#include Eerrno.hE\n" "#include Estdlib.hE\n" "#include Eunistd.hE\n" #. type: Plain text #: build/C/man3/pthread_cancel.3:162 #, no-wrap msgid "" "static void *\n" "thread_func(void *ignored_argument)\n" "{\n" " int s;\n" msgstr "" "static void *\n" "thread_func(void *ignored_argument)\n" "{\n" " int s;\n" #. type: Plain text #: build/C/man3/pthread_cancel.3:165 #, no-wrap msgid "" " /* Disable cancellation for a while, so that we don\\(aqt\n" " immediately react to a cancellation request */\n" msgstr "" " /* Disable cancellation for a while, so that we don\\(aqt\n" " immediately react to a cancellation request */\n" #. type: Plain text #: build/C/man3/pthread_cancel.3:169 #, no-wrap msgid "" " s = pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_setcancelstate\");\n" msgstr "" " s = pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_setcancelstate\");\n" #. type: Plain text #: build/C/man3/pthread_cancel.3:173 #, no-wrap msgid "" " printf(\"thread_func(): started; cancellation disabled\\en\");\n" " sleep(5);\n" " printf(\"thread_func(): about to enable cancellation\\en\");\n" msgstr "" " printf(\"thread_func(): started; cancellation disabled\\en\");\n" " sleep(5);\n" " printf(\"thread_func(): about to enable cancellation\\en\");\n" #. type: Plain text #: build/C/man3/pthread_cancel.3:177 #, no-wrap msgid "" " s = pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_setcancelstate\");\n" msgstr "" " s = pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_setcancelstate\");\n" #. type: Plain text #: build/C/man3/pthread_cancel.3:179 #, no-wrap msgid " /* sleep() is a cancellation point */\n" msgstr " /* sleep() is a cancellation point */\n" #. type: Plain text #: build/C/man3/pthread_cancel.3:181 #, no-wrap msgid " sleep(1000); /* Should get canceled while we sleep */\n" msgstr " sleep(1000); /* Should get canceled while we sleep */\n" #. type: Plain text #: build/C/man3/pthread_cancel.3:183 #, no-wrap msgid " /* Should never get here */\n" msgstr " /* Should never get here */\n" #. type: Plain text #: build/C/man3/pthread_cancel.3:187 #, no-wrap msgid "" " printf(\"thread_func(): not canceled!\\en\");\n" " return NULL;\n" "}\n" msgstr "" " printf(\"thread_func(): not canceled!\\en\");\n" " return NULL;\n" "}\n" #. type: Plain text #: build/C/man3/pthread_cancel.3:194 #, no-wrap msgid "" "int\n" "main(void)\n" "{\n" " pthread_t thr;\n" " void *res;\n" " int s;\n" msgstr "" "int\n" "main(void)\n" "{\n" " pthread_t thr;\n" " void *res;\n" " int s;\n" #. type: Plain text #: build/C/man3/pthread_cancel.3:196 #, no-wrap msgid " /* Start a thread and then send it a cancellation request */\n" msgstr " /* Start a thread and then send it a cancellation request */\n" #. type: Plain text #: build/C/man3/pthread_cancel.3:200 #, no-wrap msgid "" " s = pthread_create(&thr, NULL, &thread_func, NULL);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_create\");\n" msgstr "" " s = pthread_create(&thr, NULL, &thread_func, NULL);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_create\");\n" #. type: Plain text #: build/C/man3/pthread_cancel.3:202 #, no-wrap msgid " sleep(2); /* Give thread a chance to get started */\n" msgstr " sleep(2); /* Give thread a chance to get started */\n" #. type: Plain text #: build/C/man3/pthread_cancel.3:207 #, no-wrap msgid "" " printf(\"main(): sending cancellation request\\en\");\n" " s = pthread_cancel(thr);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_cancel\");\n" msgstr "" " printf(\"main(): sending cancellation request\\en\");\n" " s = pthread_cancel(thr);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_cancel\");\n" #. type: Plain text #: build/C/man3/pthread_cancel.3:209 #, no-wrap msgid " /* Join with thread to see what its exit status was */\n" msgstr " /* Join with thread to see what its exit status was */\n" #. type: Plain text #: build/C/man3/pthread_cancel.3:213 build/C/man3/pthread_cleanup_push.3:301 #, no-wrap msgid "" " s = pthread_join(thr, &res);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_join\");\n" msgstr "" " s = pthread_join(thr, &res);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_join\");\n" #. type: Plain text #: build/C/man3/pthread_cancel.3:220 #, no-wrap msgid "" " if (res == PTHREAD_CANCELED)\n" " printf(\"main(): thread was canceled\\en\");\n" " else\n" " printf(\"main(): thread wasn\\(aqt canceled (shouldn\\(aqt happen!)\\en\");\n" " exit(EXIT_SUCCESS);\n" "}\n" msgstr "" " if (res == PTHREAD_CANCELED)\n" " printf(\"main(): thread was canceled\\en\");\n" " else\n" " printf(\"main(): thread wasn\\(aqt canceled (shouldn\\(aqt happen!)\\en\");\n" " exit(EXIT_SUCCESS);\n" "}\n" #. type: Plain text #: build/C/man3/pthread_cancel.3:230 msgid "" "B(3), B(3), B(3), " "B(3), B(3), B(3), " "B(3), B(3), B(7)" msgstr "" "B(3), B(3), B(3), " "B(3), B(3), B(3), " "B(3), B(3), B(7)" #. type: TH #: build/C/man3/pthread_cleanup_push.3:24 #, no-wrap msgid "PTHREAD_CLEANUP_PUSH" msgstr "PTHREAD_CLEANUP_PUSH" #. type: TH #: build/C/man3/pthread_cleanup_push.3:24 #: build/C/man3/pthread_setcancelstate.3:24 #, no-wrap msgid "2008-11-24" msgstr "2008-11-24" #. type: Plain text #: build/C/man3/pthread_cleanup_push.3:28 msgid "" "pthread_cleanup_push, pthread_cleanup_pop - push and pop thread cancellation " "clean-up handlers" msgstr "" #. type: Plain text #: build/C/man3/pthread_cleanup_push.3:35 #, no-wrap msgid "" "BIB<)(void *),>\n" "B< void *>IB<);>\n" "BIB<);>\n" msgstr "" "BIB<)(void *),>\n" "B< void *>IB<);>\n" "BIB<);>\n" #. type: Plain text #: build/C/man3/pthread_cleanup_push.3:46 msgid "" "These functions manipulate the calling thread's stack of thread-cancellation " "clean-up handlers. A clean-up handler is a function that is automatically " "executed when a thread is canceled (or in various other circumstances " "described below); it might, for example, unlock a mutex so that it becomes " "available to other threads in the process." msgstr "" #. type: Plain text #: build/C/man3/pthread_cleanup_push.3:57 msgid "" "The B() function pushes I onto the top of " "the stack of clean-up handlers. When I is later invoked, it will " "be given I as its argument." msgstr "" #. type: Plain text #: build/C/man3/pthread_cleanup_push.3:64 msgid "" "The B() function removes the routine at the top of the " "stack of clean-up handlers, and optionally executes it if I is " "nonzero." msgstr "" #. type: Plain text #: build/C/man3/pthread_cleanup_push.3:67 msgid "" "A cancellation clean-up handler is popped from the stack and executed in the " "following circumstances:" msgstr "" #. type: Plain text #: build/C/man3/pthread_cleanup_push.3:71 msgid "" "When a thread is canceled, all of the stacked clean-up handlers are popped " "and executed in the reverse of the order in which they were pushed onto the " "stack." msgstr "" #. type: Plain text #: build/C/man3/pthread_cleanup_push.3:79 msgid "" "When a thread terminates by calling B(3), all clean-up " "handlers are executed as described in the preceding point. (Clean-up " "handlers are I called if the thread terminates by performing a " "I from the thread start function.)" msgstr "" #. type: Plain text #: build/C/man3/pthread_cleanup_push.3:85 msgid "" "When a thread calls B() with a nonzero I " "argument, the top-most clean-up handler is popped and executed." msgstr "" #. type: Plain text #: build/C/man3/pthread_cleanup_push.3:97 msgid "" "POSIX.1 permits B() and B() to " "be implemented as macros that expand to text containing \\(aqB<{>\\(aq and " "\\(aqB<}>\\(aq, respectively. For this reason, the caller must ensure that " "calls to these functions are paired within the same function, and at the " "same lexical nesting level. (In other words, a clean-up handler is only " "established during the execution of a specified section of code.)" msgstr "" #. type: Plain text #: build/C/man3/pthread_cleanup_push.3:117 msgid "" "Calling B(3) (B(3)) produces undefined results if any " "call has been made to B() or B" "() without the matching call of the pair since the jump buffer was filled " "by B(3) (B(3)). Likewise, calling B(3) " "(B(3)) from inside a clean-up handler produces undefined " "results unless the jump buffer was also filled by B(3) (B" "(3)) inside the handler." msgstr "" #. type: Plain text #: build/C/man3/pthread_cleanup_push.3:119 msgid "These functions do not return a value." msgstr "" #. SH VERSIONS #. Available since glibc 2.0 #. type: Plain text #: build/C/man3/pthread_cleanup_push.3:123 msgid "There are no errors." msgstr "" #. type: Plain text #: build/C/man3/pthread_cleanup_push.3:134 msgid "" "On Linux, the B() and B() " "functions I implemented as macros that expand to text containing \\(aqB<" "{>\\(aq and \\(aqB<}>\\(aq, respectively. This means that variables " "declared within the scope of paired calls to these functions will only be " "visible within that scope." msgstr "" #. The text was actually added in the 2004 TC2 #. type: Plain text #: build/C/man3/pthread_cleanup_push.3:149 msgid "" "POSIX.1 says that the effect of using I, I, I, or " "I to prematurely leave a block bracketed B() " "and B() is undefined. Portable applications should " "avoid doing this." msgstr "" #. type: Plain text #: build/C/man3/pthread_cleanup_push.3:164 msgid "" "The program below provides a simple example of the use of the functions " "described in this page. The program creates a thread that executes a loop " "bracketed by B() and B(). This " "loop increments a global variable, I, once each second. Depending on " "what command-line arguments are supplied, the main thread sends the other " "thread a cancellation request, or sets a global variable that causes the " "other thread to exit its loop and terminate normally (by doing a I)." msgstr "" #. type: Plain text #: build/C/man3/pthread_cleanup_push.3:167 msgid "" "In the following shell session, the main thread sends a cancellation request " "to the other thread:" msgstr "" #. type: Plain text #: build/C/man3/pthread_cleanup_push.3:177 #, no-wrap msgid "" "$ B<./a.out>\n" "New thread started\n" "cnt = 0\n" "cnt = 1\n" "Canceling thread\n" "Called clean-up handler\n" "Thread was canceled; cnt = 0\n" msgstr "" "$ B<./a.out>\n" "New thread started\n" "cnt = 0\n" "cnt = 1\n" "Canceling thread\n" "Called clean-up handler\n" "Thread was canceled; cnt = 0\n" #. type: Plain text #: build/C/man3/pthread_cleanup_push.3:185 msgid "" "From the above, we see that the thread was canceled, and that the " "cancellation clean-up handler was called and it reset the value of the " "global variable I to 0." msgstr "" #. type: Plain text #: build/C/man3/pthread_cleanup_push.3:188 msgid "" "In the next run, the main program sets a global variable that causes other " "thread to terminate normally:" msgstr "" #. type: Plain text #: build/C/man3/pthread_cleanup_push.3:196 #, no-wrap msgid "" "$ B<./a.out x>\n" "New thread started\n" "cnt = 0\n" "cnt = 1\n" "Thread terminated normally; cnt = 2\n" msgstr "" "$ B<./a.out x>\n" "New thread started\n" "cnt = 0\n" "cnt = 1\n" "Thread terminated normally; cnt = 2\n" #. type: Plain text #: build/C/man3/pthread_cleanup_push.3:204 msgid "" "From the above, we see that the clean-up handler was not executed (because " "I was 0), and therefore the value of I was not reset." msgstr "" #. type: Plain text #: build/C/man3/pthread_cleanup_push.3:209 msgid "" "In the next run, the main program sets a global variable that causes the " "other thread to terminate normally, and supplies a nonzero value for " "I:" msgstr "" #. type: Plain text #: build/C/man3/pthread_cleanup_push.3:218 #, no-wrap msgid "" "$ B<./a.out x 1>\n" "New thread started\n" "cnt = 0\n" "cnt = 1\n" "Called clean-up handler\n" "Thread terminated normally; cnt = 0\n" msgstr "" "$ B<./a.out x 1>\n" "New thread started\n" "cnt = 0\n" "cnt = 1\n" "Called clean-up handler\n" "Thread terminated normally; cnt = 0\n" #. type: Plain text #: build/C/man3/pthread_cleanup_push.3:225 msgid "" "In the above, we see that although the thread was not canceled, the clean-up " "handler was executed, because the argument given to B" "() was nonzero." msgstr "" #. type: Plain text #: build/C/man3/pthread_cleanup_push.3:234 #, no-wrap msgid "" "#include Epthread.hE\n" "#include Esys/types.hE\n" "#include Estdio.hE\n" "#include Estdlib.hE\n" "#include Eunistd.hE\n" "#include Eerrno.hE\n" msgstr "" "#include Epthread.hE\n" "#include Esys/types.hE\n" "#include Estdio.hE\n" "#include Estdlib.hE\n" "#include Eunistd.hE\n" "#include Eerrno.hE\n" #. type: Plain text #: build/C/man3/pthread_cleanup_push.3:241 #, no-wrap msgid "" "static int done = 0;\n" "static int cleanup_pop_arg = 0;\n" "static int cnt = 0;\n" msgstr "" "static int done = 0;\n" "static int cleanup_pop_arg = 0;\n" "static int cnt = 0;\n" #. type: Plain text #: build/C/man3/pthread_cleanup_push.3:248 #, no-wrap msgid "" "static void\n" "cleanup_handler(void *arg)\n" "{\n" " printf(\"Called clean-up handler\\en\");\n" " cnt = 0;\n" "}\n" msgstr "" "static void\n" "cleanup_handler(void *arg)\n" "{\n" " printf(\"Called clean-up handler\\en\");\n" " cnt = 0;\n" "}\n" #. type: Plain text #: build/C/man3/pthread_cleanup_push.3:253 #, no-wrap msgid "" "static void *\n" "thread_start(void *arg)\n" "{\n" " time_t start, curr;\n" msgstr "" "static void *\n" "thread_start(void *arg)\n" "{\n" " time_t start, curr;\n" #. type: Plain text #: build/C/man3/pthread_cleanup_push.3:255 #, no-wrap msgid " printf(\"New thread started\\en\");\n" msgstr " printf(\"New thread started\\en\");\n" #. type: Plain text #: build/C/man3/pthread_cleanup_push.3:257 #, no-wrap msgid " pthread_cleanup_push(cleanup_handler, NULL);\n" msgstr " pthread_cleanup_push(cleanup_handler, NULL);\n" #. type: Plain text #: build/C/man3/pthread_cleanup_push.3:259 #, no-wrap msgid " curr = start = time(NULL);\n" msgstr " curr = start = time(NULL);\n" #. type: Plain text #: build/C/man3/pthread_cleanup_push.3:268 #, no-wrap msgid "" " while (!done) {\n" " pthread_testcancel(); /* A cancellation point */\n" " if (curr E time(NULL)) {\n" " curr = time(NULL);\n" " printf(\"cnt = %d\\en\", cnt); /* A cancellation point */\n" " cnt++;\n" " }\n" " }\n" msgstr "" " while (!done) {\n" " pthread_testcancel(); /* A cancellation point */\n" " if (curr E time(NULL)) {\n" " curr = time(NULL);\n" " printf(\"cnt = %d\\en\", cnt); /* A cancellation point */\n" " cnt++;\n" " }\n" " }\n" #. type: Plain text #: build/C/man3/pthread_cleanup_push.3:272 #, no-wrap msgid "" " pthread_cleanup_pop(cleanup_pop_arg);\n" " return NULL;\n" "}\n" msgstr "" " pthread_cleanup_pop(cleanup_pop_arg);\n" " return NULL;\n" "}\n" #. type: Plain text #: build/C/man3/pthread_cleanup_push.3:279 #, no-wrap msgid "" "int\n" "main(int argc, char *argv[])\n" "{\n" " pthread_t thr;\n" " int s;\n" " void *res;\n" msgstr "" "int\n" "main(int argc, char *argv[])\n" "{\n" " pthread_t thr;\n" " int s;\n" " void *res;\n" #. type: Plain text #: build/C/man3/pthread_cleanup_push.3:283 #, no-wrap msgid "" " s = pthread_create(&thr, NULL, thread_start, NULL);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_create\");\n" msgstr "" " s = pthread_create(&thr, NULL, thread_start, NULL);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_create\");\n" #. type: Plain text #: build/C/man3/pthread_cleanup_push.3:285 #, no-wrap msgid " sleep(2); /* Allow new thread to run a while */\n" msgstr " sleep(2); /* Allow new thread to run a while */\n" #. type: Plain text #: build/C/man3/pthread_cleanup_push.3:290 #, no-wrap msgid "" " if (argc E 1) {\n" " if (argc E 2)\n" " cleanup_pop_arg = atoi(argv[2]);\n" " done = 1;\n" msgstr "" " if (argc E 1) {\n" " if (argc E 2)\n" " cleanup_pop_arg = atoi(argv[2]);\n" " done = 1;\n" #. type: Plain text #: build/C/man3/pthread_cleanup_push.3:297 #, no-wrap msgid "" " } else {\n" " printf(\"Canceling thread\\en\");\n" " s = pthread_cancel(thr);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_cancel\");\n" " }\n" msgstr "" " } else {\n" " printf(\"Canceling thread\\en\");\n" " s = pthread_cancel(thr);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_cancel\");\n" " }\n" #. type: Plain text #: build/C/man3/pthread_cleanup_push.3:308 #, no-wrap msgid "" " if (res == PTHREAD_CANCELED)\n" " printf(\"Thread was canceled; cnt = %d\\en\", cnt);\n" " else\n" " printf(\"Thread terminated normally; cnt = %d\\en\", cnt);\n" " exit(EXIT_SUCCESS);\n" "}\n" msgstr "" " if (res == PTHREAD_CANCELED)\n" " printf(\"Thread was canceled; cnt = %d\\en\", cnt);\n" " else\n" " printf(\"Thread terminated normally; cnt = %d\\en\", cnt);\n" " exit(EXIT_SUCCESS);\n" "}\n" #. type: Plain text #: build/C/man3/pthread_cleanup_push.3:314 msgid "" "B(3), B(3), " "B(3), B(3), B(7)" msgstr "" "B(3), B(3), " "B(3), B(3), B(7)" #. type: TH #: build/C/man3/pthread_cleanup_push_defer_np.3:24 #, no-wrap msgid "PTHREAD_CLEANUP_PUSH_DEFER_NP" msgstr "PTHREAD_CLEANUP_PUSH_DEFER_NP" #. type: TH #: build/C/man3/pthread_cleanup_push_defer_np.3:24 #, no-wrap msgid "2008-12-04" msgstr "2008-12-04" #. type: Plain text #: build/C/man3/pthread_cleanup_push_defer_np.3:28 msgid "" "pthread_cleanup_push_defer_np, pthread_cleanup_pop_restore_np - push and pop " "thread cancellation clean-up handlers while saving cancelability type" msgstr "" #. type: Plain text #: build/C/man3/pthread_cleanup_push_defer_np.3:35 #, no-wrap msgid "" "BIB<)(void *),>\n" "B< void *>IB<);>\n" "BIB<);>\n" msgstr "" "BIB<)(void *),>\n" "B< void *>IB<);>\n" "BIB<);>\n" #. type: Plain text #: build/C/man3/pthread_cleanup_push_defer_np.3:38 #: build/C/man3/pthread_create.3:36 build/C/man3/pthread_detach.3:35 #: build/C/man3/pthread_join.3:35 build/C/man3/pthread_kill.3:35 #: build/C/man3/pthread_sigmask.3:36 build/C/man3/pthread_sigqueue.3:35 #: build/C/man3/pthread_tryjoin_np.3:40 build/C/man3/pthread_yield.3:34 msgid "Compile and link with I<-pthread>." msgstr "" #. type: Plain text #: build/C/man3/pthread_cleanup_push_defer_np.3:44 msgid "" "These functions are the same as B(3) and " "B(3), except for the differences noted on this page." msgstr "" #. type: Plain text #: build/C/man3/pthread_cleanup_push_defer_np.3:57 msgid "" "Like B(3), B() pushes " "I onto the thread's stack of cancellation clean-up handlers. In " "addition, it also saves the thread's current cancelability type, and sets " "the cancelability type to \"deferred\" (see B(3)); " "this ensures that cancellation clean-up will occur even if the thread's " "cancelability type was \"asynchronous\" before the call." msgstr "" #. type: Plain text #: build/C/man3/pthread_cleanup_push_defer_np.3:66 msgid "" "Like B(3), B() pops " "the top-most clean-up handler from the thread's stack of cancellation clean-" "up handlers. In addition, it restores the thread's cancelability type to " "its value at the time of the matching B()." msgstr "" #. type: Plain text #: build/C/man3/pthread_cleanup_push_defer_np.3:72 msgid "" "The caller must ensure that calls to these functions are paired within the " "same function, and at the same lexical nesting level. Other restrictions " "apply, as described in B(3)." msgstr "" #. type: Plain text #: build/C/man3/pthread_cleanup_push_defer_np.3:74 msgid "This sequence of calls:" msgstr "" #. type: Plain text #: build/C/man3/pthread_cleanup_push_defer_np.3:79 #, no-wrap msgid "" "pthread_cleanup_push_defer_np(routine, arg);\n" "pthread_cleanup_pop_restore_np(execute);\n" msgstr "" #. type: Plain text #: build/C/man3/pthread_cleanup_push_defer_np.3:83 msgid "is equivalent to (but shorter and more efficient than):" msgstr "" #. type: Plain text #: build/C/man3/pthread_cleanup_push_defer_np.3:89 #, no-wrap msgid "int oldtype;\n" msgstr "int oldtype;\n" #. type: Plain text #: build/C/man3/pthread_cleanup_push_defer_np.3:95 #, no-wrap msgid "" "pthread_cleanup_push(routine, arg);\n" "pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, &oldtype);\n" "\\&...\n" "pthread_setcanceltype(oldtype, NULL);\n" "pthread_cleanup_pop(execute);\n" msgstr "" "pthread_cleanup_push(routine, arg);\n" "pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, &oldtype);\n" "\\&...\n" "pthread_setcanceltype(oldtype, NULL);\n" "pthread_cleanup_pop(execute);\n" #. type: Plain text #: build/C/man3/pthread_cleanup_push_defer_np.3:107 msgid "" "B(3), B(3), B" "(3), B(3), B(7)" msgstr "" "B(3), B(3), B" "(3), B(3), B(7)" #. type: TH #: build/C/man3/pthread_create.3:24 #, no-wrap msgid "PTHREAD_CREATE" msgstr "PTHREAD_CREATE" #. type: Plain text #: build/C/man3/pthread_create.3:27 msgid "pthread_create - create a new thread" msgstr "" #. type: Plain text #: build/C/man3/pthread_create.3:33 #, no-wrap msgid "" "BIB<, const pthread_attr_t *>IB<,>\n" "B< void *(*>IB<) (void *), void *>IB<);>\n" msgstr "" "BIB<, const pthread_attr_t *>IB<,>\n" "B< void *(*>IB<) (void *), void *>IB<);>\n" #. type: Plain text #: build/C/man3/pthread_create.3:45 msgid "" "The B() function starts a new thread in the calling " "process. The new thread starts execution by invoking I(); " "I is passed as the sole argument of I()." msgstr "" #. type: Plain text #: build/C/man3/pthread_create.3:47 msgid "The new thread terminates in one of the following ways:" msgstr "" #. type: IP #: build/C/man3/pthread_create.3:47 build/C/man3/pthread_create.3:53 #: build/C/man3/pthread_create.3:61 build/C/man3/pthread_create.3:64 #: build/C/man3/pthread_getattr_np.3:50 build/C/man3/pthread_getattr_np.3:53 #: build/C/man3/pthread_getattr_np.3:56 #, no-wrap msgid "*" msgstr "*" #. type: Plain text #: build/C/man3/pthread_create.3:53 msgid "" "It calls B(3), specifying an exit status value that is " "available to another thread in the same process that calls B" "(3)." msgstr "" #. type: Plain text #: build/C/man3/pthread_create.3:61 msgid "" "It returns from I(). This is equivalent to calling " "B(3) with the value supplied in the I statement." msgstr "" #. type: Plain text #: build/C/man3/pthread_create.3:64 msgid "It is canceled (see B(3))." msgstr "" #. type: Plain text #: build/C/man3/pthread_create.3:70 msgid "" "Any of the threads in the process calls B(3), or the main thread " "performs a return from I
(). This causes the termination of all " "threads in the process." msgstr "" #. type: Plain text #: build/C/man3/pthread_create.3:84 msgid "" "The I argument points to a I structure whose contents " "are used at thread creation time to determine attributes for the new thread; " "this structure is initialized using B(3) and related " "functions. If I is NULL, then the thread is created with default " "attributes." msgstr "" #. type: Plain text #: build/C/man3/pthread_create.3:91 msgid "" "Before returning, a successful call to B() stores the ID of " "the new thread in the buffer pointed to by I; this identifier is " "used to refer to the thread in subsequent calls to other pthreads functions." msgstr "" #. type: Plain text #: build/C/man3/pthread_create.3:99 msgid "" "The new thread inherits a copy of the creating thread's signal mask " "(B(3)). The set of pending signals for the new thread is " "empty (B(2)). The new thread does not inherit the creating " "thread's alternate signal stack (B(2))." msgstr "" #. type: Plain text #: build/C/man3/pthread_create.3:102 msgid "" "The new thread inherits the calling thread's floating-point environment " "(B(3))." msgstr "" #. CLOCK_THREAD_CPUTIME_ID in clock_gettime(2) #. type: Plain text #: build/C/man3/pthread_create.3:107 msgid "" "The initial value of the new thread's CPU-time clock is 0 (see " "B(3))." msgstr "" #. type: SS #: build/C/man3/pthread_create.3:107 #, no-wrap msgid "Linux-specific details" msgstr "" #. type: Plain text #: build/C/man3/pthread_create.3:113 msgid "" "The new thread inherits copies of the calling thread's capability sets (see " "B(7)) and CPU affinity mask (see B(2))." msgstr "" #. type: Plain text #: build/C/man3/pthread_create.3:120 msgid "" "On success, B() returns 0; on error, it returns an error " "number, and the contents of I<*thread> are undefined." msgstr "" #. type: TP #: build/C/man3/pthread_create.3:121 build/C/man3/pthread_sigqueue.3:69 #, no-wrap msgid "B" msgstr "B" #. type: Plain text #: build/C/man3/pthread_create.3:135 msgid "" "Insufficient resources to create another thread, or a system-imposed limit " "on the number of threads was encountered. The latter case may occur in two " "ways: the B soft resource limit (set via B(2)), " "which limits the number of process for a real user ID, was reached; or the " "kernel's system-wide limit on the number of threads, I, was reached." msgstr "" #. type: Plain text #: build/C/man3/pthread_create.3:139 msgid "Invalid settings in I." msgstr "" #. type: TP #: build/C/man3/pthread_create.3:139 build/C/man3/pthread_setschedparam.3:127 #: build/C/man3/pthread_setschedprio.3:64 #, no-wrap msgid "B" msgstr "B" #. type: Plain text #: build/C/man3/pthread_create.3:144 msgid "" "No permission to set the scheduling policy and parameters specified in " "I." msgstr "" #. type: Plain text #: build/C/man3/pthread_create.3:158 msgid "" "See B(3) for further information on the thread ID returned in " "I<*thread> by B(). Unless real-time scheduling policies are " "being employed, after a call to B(), it is indeterminate " "which thread\\(emthe caller or the new thread\\(emwill next execute." msgstr "" #. type: Plain text #: build/C/man3/pthread_create.3:178 msgid "" "A thread may either be I or I. If a thread is joinable, " "then another thread can call B(3) to wait for the thread to " "terminate and fetch its exit status. Only when a terminated joinable thread " "has been joined are the last of its resources released back to the system. " "When a detached thread terminates, its resources are automatically released " "back to the system: it is not possible to join with the thread in order to " "obtain its exit status. Making a thread detached is useful for some types " "of daemon threads whose exit status the application does not need to care " "about. By default, a new thread is created in a joinable state, unless " "I was set to create the thread in a detached state (using " "B(3))." msgstr "" #. FIXME . Perhaps some of the following detail should be in #. a future pthread_attr_setstacksize(3) page. #. type: Plain text #: build/C/man3/pthread_create.3:194 msgid "" "On Linux/x86-32, the default stack size for a new thread is 2 megabytes. " "Under the NPTL threading implementation, if the B soft " "resource limit I has any value other than " "\"unlimited\", then it determines the default stack size of new threads. " "Using B(3), the stack size attribute can be " "explicitly set in the I argument used to create a thread, in order to " "obtain a stack size other than the default." msgstr "" #. type: Plain text #: build/C/man3/pthread_create.3:200 msgid "" "In the obsolete LinuxThreads implementation, each of the threads in a " "process has a different process ID. This is in violation of the POSIX " "threads specification, and is the source of many other nonconformances to " "the standard; see B(7)." msgstr "" #. type: Plain text #: build/C/man3/pthread_create.3:204 msgid "" "The program below demonstrates the use of B(), as well as a " "number of other functions in the pthreads API." msgstr "" #. type: Plain text #: build/C/man3/pthread_create.3:209 msgid "" "In the following run, on a system providing the NPTL threading " "implementation, the stack size defaults to the value given by the \"stack " "size\" resource limit:" msgstr "" #. type: Plain text #: build/C/man3/pthread_create.3:221 #, no-wrap msgid "" "$B< ulimit -s>\n" "8192 # The stack size limit is 8 MB (0x80000 bytes)\n" "$B< ./a.out hola salut servus>\n" "Thread 1: top of stack near 0xb7dd03b8; argv_string=hola\n" "Thread 2: top of stack near 0xb75cf3b8; argv_string=salut\n" "Thread 3: top of stack near 0xb6dce3b8; argv_string=servus\n" "Joined with thread 1; returned value was HOLA\n" "Joined with thread 2; returned value was SALUT\n" "Joined with thread 3; returned value was SERVUS\n" msgstr "" "$B< ulimit -s>\n" "8192 # The stack size limit is 8 MB (0x80000 bytes)\n" "$B< ./a.out hola salut servus>\n" "Thread 1: top of stack near 0xb7dd03b8; argv_string=hola\n" "Thread 2: top of stack near 0xb75cf3b8; argv_string=salut\n" "Thread 3: top of stack near 0xb6dce3b8; argv_string=servus\n" "Joined with thread 1; returned value was HOLA\n" "Joined with thread 2; returned value was SALUT\n" "Joined with thread 3; returned value was SERVUS\n" #. type: Plain text #: build/C/man3/pthread_create.3:227 msgid "" "In the next run, the program explicitly sets a stack size of 1MB (using " "B(3)) for the created threads:" msgstr "" #. type: Plain text #: build/C/man3/pthread_create.3:237 #, no-wrap msgid "" "$B< ./a.out -s 0x100000 hola salut servus>\n" "Thread 1: top of stack near 0xb7d723b8; argv_string=hola\n" "Thread 2: top of stack near 0xb7c713b8; argv_string=salut\n" "Thread 3: top of stack near 0xb7b703b8; argv_string=servus\n" "Joined with thread 1; returned value was HOLA\n" "Joined with thread 2; returned value was SALUT\n" "Joined with thread 3; returned value was SERVUS\n" msgstr "" "$B< ./a.out -s 0x100000 hola salut servus>\n" "Thread 1: top of stack near 0xb7d723b8; argv_string=hola\n" "Thread 2: top of stack near 0xb7c713b8; argv_string=salut\n" "Thread 3: top of stack near 0xb7b703b8; argv_string=servus\n" "Joined with thread 1; returned value was HOLA\n" "Joined with thread 2; returned value was SALUT\n" "Joined with thread 3; returned value was SERVUS\n" #. type: Plain text #: build/C/man3/pthread_create.3:249 #, no-wrap msgid "" "#include Epthread.hE\n" "#include Estring.hE\n" "#include Estdio.hE\n" "#include Estdlib.hE\n" "#include Eunistd.hE\n" "#include Eerrno.hE\n" "#include Ectype.hE\n" msgstr "" "#include Epthread.hE\n" "#include Estring.hE\n" "#include Estdio.hE\n" "#include Estdlib.hE\n" "#include Eunistd.hE\n" "#include Eerrno.hE\n" "#include Ectype.hE\n" #. type: Plain text #: build/C/man3/pthread_create.3:255 build/C/man3/pthread_getcpuclockid.3:108 #, no-wrap msgid "" "#define handle_error(msg) \\e\n" " do { perror(msg); exit(EXIT_FAILURE); } while (0)\n" msgstr "" "#define handle_error(msg) \\e\n" " do { perror(msg); exit(EXIT_FAILURE); } while (0)\n" #. type: Plain text #: build/C/man3/pthread_create.3:261 #, no-wrap msgid "" "struct thread_info { /* Used as argument to thread_start() */\n" " pthread_t thread_id; /* ID returned by pthread_create() */\n" " int thread_num; /* Application-defined thread # */\n" " char *argv_string; /* From command-line argument */\n" "};\n" msgstr "" "struct thread_info { /* Used as argument to thread_start() */\n" " pthread_t thread_id; /* ID returned by pthread_create() */\n" " int thread_num; /* Application-defined thread # */\n" " char *argv_string; /* From command-line argument */\n" "};\n" #. type: Plain text #: build/C/man3/pthread_create.3:264 #, no-wrap msgid "" "/* Thread start function: display address near top of our stack,\n" " and return upper-cased copy of argv_string */\n" msgstr "" "/* Thread start function: display address near top of our stack,\n" " and return upper-cased copy of argv_string */\n" #. type: Plain text #: build/C/man3/pthread_create.3:270 #, no-wrap msgid "" "static void *\n" "thread_start(void *arg)\n" "{\n" " struct thread_info *tinfo = (struct thread_info *) arg;\n" " char *uargv, *p;\n" msgstr "" "static void *\n" "thread_start(void *arg)\n" "{\n" " struct thread_info *tinfo = (struct thread_info *) arg;\n" " char *uargv, *p;\n" #. type: Plain text #: build/C/man3/pthread_create.3:273 #, no-wrap msgid "" " printf(\"Thread %d: top of stack near %p; argv_string=%s\\en\",\n" " tinfo-Ethread_num, &p, tinfo-Eargv_string);\n" msgstr "" " printf(\"Thread %d: top of stack near %p; argv_string=%s\\en\",\n" " tinfo-Ethread_num, &p, tinfo-Eargv_string);\n" #. type: Plain text #: build/C/man3/pthread_create.3:277 #, no-wrap msgid "" " uargv = strdup(tinfo-Eargv_string);\n" " if (uargv == NULL)\n" " handle_error(\"strdup\");\n" msgstr "" " uargv = strdup(tinfo-Eargv_string);\n" " if (uargv == NULL)\n" " handle_error(\"strdup\");\n" #. type: Plain text #: build/C/man3/pthread_create.3:280 #, no-wrap msgid "" " for (p = uargv; *p != \\(aq\\e0\\(aq; p++)\n" " *p = toupper(*p);\n" msgstr "" " for (p = uargv; *p != \\(aq\\e0\\(aq; p++)\n" " *p = toupper(*p);\n" #. type: Plain text #: build/C/man3/pthread_create.3:283 #, no-wrap msgid "" " return uargv;\n" "}\n" msgstr "" " return uargv;\n" "}\n" #. type: Plain text #: build/C/man3/pthread_create.3:292 #, no-wrap msgid "" "int\n" "main(int argc, char *argv[])\n" "{\n" " int s, tnum, opt, num_threads;\n" " struct thread_info *tinfo;\n" " pthread_attr_t attr;\n" " int stack_size;\n" " void *res;\n" msgstr "" "int\n" "main(int argc, char *argv[])\n" "{\n" " int s, tnum, opt, num_threads;\n" " struct thread_info *tinfo;\n" " pthread_attr_t attr;\n" " int stack_size;\n" " void *res;\n" #. type: Plain text #: build/C/man3/pthread_create.3:294 #, no-wrap msgid " /* The \"-s\" option specifies a stack size for our threads */\n" msgstr " /* The \"-s\" option specifies a stack size for our threads */\n" #. type: Plain text #: build/C/man3/pthread_create.3:301 #, no-wrap msgid "" " stack_size = -1;\n" " while ((opt = getopt(argc, argv, \"s:\")) != -1) {\n" " switch (opt) {\n" " case \\(aqs\\(aq:\n" " stack_size = strtoul(optarg, NULL, 0);\n" " break;\n" msgstr "" " stack_size = -1;\n" " while ((opt = getopt(argc, argv, \"s:\")) != -1) {\n" " switch (opt) {\n" " case \\(aqs\\(aq:\n" " stack_size = strtoul(optarg, NULL, 0);\n" " break;\n" #. type: Plain text #: build/C/man3/pthread_create.3:308 #, no-wrap msgid "" " default:\n" " fprintf(stderr, \"Usage: %s [-s stack-size] arg...\\en\",\n" " argv[0]);\n" " exit(EXIT_FAILURE);\n" " }\n" " }\n" msgstr "" " default:\n" " fprintf(stderr, \"Usage: %s [-s stack-size] arg...\\en\",\n" " argv[0]);\n" " exit(EXIT_FAILURE);\n" " }\n" " }\n" #. type: Plain text #: build/C/man3/pthread_create.3:310 #, no-wrap msgid " num_threads = argc - optind;\n" msgstr " num_threads = argc - optind;\n" #. type: Plain text #: build/C/man3/pthread_create.3:312 #, no-wrap msgid " /* Initialize thread creation attributes */\n" msgstr " /* Initialize thread creation attributes */\n" #. type: Plain text #: build/C/man3/pthread_create.3:316 #, no-wrap msgid "" " s = pthread_attr_init(&attr);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_attr_init\");\n" msgstr "" " s = pthread_attr_init(&attr);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_attr_init\");\n" #. type: Plain text #: build/C/man3/pthread_create.3:322 #, no-wrap msgid "" " if (stack_size E 0) {\n" " s = pthread_attr_setstacksize(&attr, stack_size);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_attr_setstacksize\");\n" " }\n" msgstr "" " if (stack_size E 0) {\n" " s = pthread_attr_setstacksize(&attr, stack_size);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_attr_setstacksize\");\n" " }\n" #. type: Plain text #: build/C/man3/pthread_create.3:324 #, no-wrap msgid " /* Allocate memory for pthread_create() arguments */\n" msgstr " /* Allocate memory for pthread_create() arguments */\n" #. type: Plain text #: build/C/man3/pthread_create.3:328 #, no-wrap msgid "" " tinfo = calloc(num_threads, sizeof(struct thread_info));\n" " if (tinfo == NULL)\n" " handle_error(\"calloc\");\n" msgstr "" " tinfo = calloc(num_threads, sizeof(struct thread_info));\n" " if (tinfo == NULL)\n" " handle_error(\"calloc\");\n" #. type: Plain text #: build/C/man3/pthread_create.3:330 #, no-wrap msgid " /* Create one thread for each command-line argument */\n" msgstr " /* Create one thread for each command-line argument */\n" #. type: Plain text #: build/C/man3/pthread_create.3:334 #, no-wrap msgid "" " for (tnum = 0; tnum E num_threads; tnum++) {\n" " tinfo[tnum].thread_num = tnum + 1;\n" " tinfo[tnum].argv_string = argv[optind + tnum];\n" msgstr "" " for (tnum = 0; tnum E num_threads; tnum++) {\n" " tinfo[tnum].thread_num = tnum + 1;\n" " tinfo[tnum].argv_string = argv[optind + tnum];\n" #. type: Plain text #: build/C/man3/pthread_create.3:337 #, no-wrap msgid "" " /* The pthread_create() call stores the thread ID into\n" " corresponding element of tinfo[] */\n" msgstr "" " /* The pthread_create() call stores the thread ID into\n" " corresponding element of tinfo[] */\n" #. type: Plain text #: build/C/man3/pthread_create.3:343 #, no-wrap msgid "" " s = pthread_create(&tinfo[tnum].thread_id, &attr,\n" " &thread_start, &tinfo[tnum]);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_create\");\n" " }\n" msgstr "" " s = pthread_create(&tinfo[tnum].thread_id, &attr,\n" " &thread_start, &tinfo[tnum]);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_create\");\n" " }\n" #. type: Plain text #: build/C/man3/pthread_create.3:346 #, no-wrap msgid "" " /* Destroy the thread attributes object, since it is no\n" " longer needed */\n" msgstr "" " /* Destroy the thread attributes object, since it is no\n" " longer needed */\n" #. type: Plain text #: build/C/man3/pthread_create.3:350 build/C/man3/pthread_setschedparam.3:421 #, no-wrap msgid "" " s = pthread_attr_destroy(&attr);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_attr_destroy\");\n" msgstr "" " s = pthread_attr_destroy(&attr);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_attr_destroy\");\n" #. type: Plain text #: build/C/man3/pthread_create.3:352 #, no-wrap msgid " /* Now join with each thread, and display its returned value */\n" msgstr " /* Now join with each thread, and display its returned value */\n" #. type: Plain text #: build/C/man3/pthread_create.3:357 #, no-wrap msgid "" " for (tnum = 0; tnum E num_threads; tnum++) {\n" " s = pthread_join(tinfo[tnum].thread_id, &res);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_join\");\n" msgstr "" " for (tnum = 0; tnum E num_threads; tnum++) {\n" " s = pthread_join(tinfo[tnum].thread_id, &res);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_join\");\n" #. type: Plain text #: build/C/man3/pthread_create.3:362 #, no-wrap msgid "" " printf(\"Joined with thread %d; returned value was %s\\en\",\n" " tinfo[tnum].thread_num, (char *) res);\n" " free(res); /* Free memory allocated by thread */\n" " }\n" msgstr "" " printf(\"Joined with thread %d; returned value was %s\\en\",\n" " tinfo[tnum].thread_num, (char *) res);\n" " free(res); /* Free memory allocated by thread */\n" " }\n" #. type: Plain text #: build/C/man3/pthread_create.3:366 #, no-wrap msgid "" " free(tinfo);\n" " exit(EXIT_SUCCESS);\n" "}\n" msgstr "" " free(tinfo);\n" " exit(EXIT_SUCCESS);\n" "}\n" #. type: Plain text #: build/C/man3/pthread_create.3:377 msgid "" "B(2), B(3), B(3), " "B(3), B(3), B(3), " "B(3), B(3), B(3), B" "(7)" msgstr "" "B(2), B(3), B(3), " "B(3), B(3), B(3), " "B(3), B(3), B(3), B" "(7)" #. type: TH #: build/C/man3/pthread_detach.3:24 #, no-wrap msgid "PTHREAD_DETACH" msgstr "PTHREAD_DETACH" #. type: TH #: build/C/man3/pthread_detach.3:24 build/C/man3/pthread_join.3:24 #, no-wrap msgid "2008-11-27" msgstr "2008-11-27" #. type: Plain text #: build/C/man3/pthread_detach.3:27 msgid "pthread_detach - detach a thread" msgstr "" #. type: Plain text #: build/C/man3/pthread_detach.3:32 #, no-wrap msgid "BIB<);>\n" msgstr "BIB<);>\n" #. type: Plain text #: build/C/man3/pthread_detach.3:44 msgid "" "The B() function marks the thread identified by I " "as detached. When a detached thread terminates, its resources are " "automatically released back to the system without the need for another " "thread to join with the terminated thread." msgstr "" #. type: Plain text #: build/C/man3/pthread_detach.3:47 msgid "" "Attempting to detach an already detached thread results in unspecified " "behavior." msgstr "" #. type: Plain text #: build/C/man3/pthread_detach.3:52 msgid "" "On success, B() returns 0; on error, it returns an error " "number." msgstr "" #. type: Plain text #: build/C/man3/pthread_detach.3:57 build/C/man3/pthread_join.3:87 msgid "I is not a joinable thread." msgstr "" #. type: Plain text #: build/C/man3/pthread_detach.3:68 msgid "" "Once a thread has been detached, it can't be joined with B(3) " "or be made joinable again." msgstr "" #. type: Plain text #: build/C/man3/pthread_detach.3:75 msgid "" "A new thread can be created in a detached state using " "B(3) to set the detached attribute of the " "I argument of B(3)." msgstr "" #. type: Plain text #: build/C/man3/pthread_detach.3:82 msgid "" "The detached attribute merely determines the behavior of the system when the " "thread terminates; it does not prevent the thread from being terminated if " "the process terminates using B(3) (or equivalently, if the main " "thread returns)." msgstr "" #. type: Plain text #: build/C/man3/pthread_detach.3:91 msgid "" "Either B(3) or B() should be called for each " "thread that an application creates, so that system resources for the thread " "can be released. (But note that the resources of all threads are freed when " "the process terminates.)" msgstr "" #. type: Plain text #: build/C/man3/pthread_detach.3:93 msgid "The following statement detaches the calling thread:" msgstr "" #. type: Plain text #: build/C/man3/pthread_detach.3:95 #, no-wrap msgid " pthread_detach(pthread_self());\n" msgstr " pthread_detach(pthread_self());\n" #. type: Plain text #: build/C/man3/pthread_detach.3:101 msgid "" "B(3), B(3), B" "(3), B(3), B(3), B(7)" msgstr "" "B(3), B(3), B" "(3), B(3), B(3), B(7)" #. type: TH #: build/C/man3/pthread_equal.3:24 #, no-wrap msgid "PTHREAD_EQUAL" msgstr "PTHREAD_EQUAL" #. type: TH #: build/C/man3/pthread_equal.3:24 build/C/man3/pthread_exit.3:24 #, no-wrap msgid "2009-03-30" msgstr "2009-03-30" #. type: Plain text #: build/C/man3/pthread_equal.3:27 msgid "pthread_equal - compare thread IDs" msgstr "" #. type: Plain text #: build/C/man3/pthread_equal.3:32 #, no-wrap msgid "BIB<, pthread_t >IB<);>\n" msgstr "BIB<, pthread_t >IB<);>\n" #. type: Plain text #: build/C/man3/pthread_equal.3:39 msgid "The B() function compares two thread identifiers." msgstr "" #. type: Plain text #: build/C/man3/pthread_equal.3:43 msgid "" "If the two thread IDs are equal, B() returns a nonzero " "value; otherwise, it returns 0." msgstr "" #. SH VERSIONS #. Available since glibc 2.0 #. type: Plain text #: build/C/man3/pthread_equal.3:45 build/C/man3/pthread_exit.3:73 #: build/C/man3/pthread_self.3:48 build/C/man3/pthread_testcancel.3:56 msgid "This function always succeeds." msgstr "" #. type: Plain text #: build/C/man3/pthread_equal.3:54 msgid "" "The B() function is necessary because thread IDs should be " "considered opaque: there is no portable way for applications to directly " "compare two I values." msgstr "" #. type: Plain text #: build/C/man3/pthread_equal.3:57 msgid "B(3), B(3), B(7)" msgstr "B(3), B(3), B(7)" #. type: TH #: build/C/man3/pthread_exit.3:24 #, no-wrap msgid "PTHREAD_EXIT" msgstr "PTHREAD_EXIT" #. type: Plain text #: build/C/man3/pthread_exit.3:27 msgid "pthread_exit - terminate calling thread" msgstr "" #. type: Plain text #: build/C/man3/pthread_exit.3:32 #, no-wrap msgid "BIB<);>\n" msgstr "BIB<);>\n" #. type: Plain text #: build/C/man3/pthread_exit.3:43 msgid "" "The B() function terminates the calling thread and returns a " "value via I that (if the thread is joinable) is available to " "another thread in the same process that calls B(3)." msgstr "" #. type: Plain text #: build/C/man3/pthread_exit.3:53 msgid "" "Any clean-up handlers established by B(3) that have " "not yet been popped, are popped (in the reverse of the order in which they " "were pushed) and executed. If the thread has any thread-specific data, " "then, after the clean-up handlers have been executed, the corresponding " "destructor functions are called, in an unspecified order." msgstr "" #. type: Plain text #: build/C/man3/pthread_exit.3:60 msgid "" "When a thread terminates, process-shared resources (e.g., mutexes, condition " "variables, semaphores, and file descriptors) are not released, and functions " "registered using B(3) are not called." msgstr "" #. type: Plain text #: build/C/man3/pthread_exit.3:69 msgid "" "After the last thread in a process terminates, the process terminates as by " "calling B(3) with an exit status of zero; thus, process-shared " "resources are released and functions registered using B(3) are " "called." msgstr "" #. type: Plain text #: build/C/man3/pthread_exit.3:71 msgid "This function does not return to the caller." msgstr "" #. type: Plain text #: build/C/man3/pthread_exit.3:80 msgid "" "Performing a return from the start function of any thread other than the " "main thread results in an implicit call to B(), using the " "function's return value as the thread's exit status." msgstr "" #. type: Plain text #: build/C/man3/pthread_exit.3:86 msgid "" "To allow other threads to continue execution, the main thread should " "terminate by calling B() rather than B(3)." msgstr "" #. type: Plain text #: build/C/man3/pthread_exit.3:91 msgid "" "The value pointed to by I should not be located on the calling " "thread's stack, since the contents of that stack are undefined after the " "thread terminates." msgstr "" #. Linux 2.6.27 #. FIXME . review a later kernel to see if this gets fixed #. http://thread.gmane.org/gmane.linux.kernel/611611 #. http://marc.info/?l=linux-kernel&m=122525468300823&w=2 #. type: Plain text #: build/C/man3/pthread_exit.3:103 msgid "" "Currently, there are limitations in the kernel implementation logic for " "B(2)ing on a stopped thread group with a dead thread group leader. " "This can manifest in problems such as a locked terminal if a stop signal is " "sent to a foreground process whose thread group leader has already called " "B()." msgstr "" #. type: Plain text #: build/C/man3/pthread_exit.3:106 msgid "B(3), B(3), B(7)" msgstr "B(3), B(3), B(7)" #. type: TH #: build/C/man3/pthread_getattr_np.3:24 #, no-wrap msgid "PTHREAD_GETATTR_NP" msgstr "PTHREAD_GETATTR_NP" #. type: Plain text #: build/C/man3/pthread_getattr_np.3:27 msgid "pthread_getattr_np - get attributes of created thread" msgstr "" #. type: Plain text #: build/C/man3/pthread_getattr_np.3:33 #, no-wrap msgid "BIB<, pthread_attr_t *>IB<);>\n" msgstr "BIB<, pthread_attr_t *>IB<);>\n" #. type: Plain text #: build/C/man3/pthread_getattr_np.3:43 msgid "" "The B() function initializes the thread attributes " "object referred to by I so that it contains actual attribute values " "describing the running thread I." msgstr "" #. type: Plain text #: build/C/man3/pthread_getattr_np.3:50 msgid "" "The returned attribute values may differ from the corresponding attribute " "values passed in the I object that was used to create the thread using " "B(3). In particular, the following attributes may differ:" msgstr "" #. type: Plain text #: build/C/man3/pthread_getattr_np.3:53 msgid "" "the detach state, since a joinable thread may have detached itself after " "creation;" msgstr "" #. type: Plain text #: build/C/man3/pthread_getattr_np.3:56 msgid "" "the stack size, which the implementation may align to a suitable boundary." msgstr "" #. type: Plain text #: build/C/man3/pthread_getattr_np.3:61 msgid "" "and the guard size, which the implementation may round upward to a multiple " "of the page size, or ignore (i.e., treat as 0), if the application is " "allocating its own stack." msgstr "" #. type: Plain text #: build/C/man3/pthread_getattr_np.3:66 msgid "" "Furthermore, if the stack address attribute was not set in the thread " "attributes object used to create the thread, then the returned thread " "attributes object will report the actual stack address that the " "implementation selected for the thread." msgstr "" #. type: Plain text #: build/C/man3/pthread_getattr_np.3:71 msgid "" "When the thread attributes object returned by B() is no " "longer required, it should be destroyed using B(3)." msgstr "" #. type: Plain text #: build/C/man3/pthread_getattr_np.3:74 #: build/C/man3/pthread_getcpuclockid.3:47 msgid "" "On success, this function returns 0; on error, it returns a nonzero error " "number." msgstr "" #. Can happen (but unlikely) while trying to allocate memory for cpuset #. type: Plain text #: build/C/man3/pthread_getattr_np.3:79 msgid "Insufficient memory." msgstr "" #. type: Plain text #: build/C/man3/pthread_getattr_np.3:94 msgid "" "In addition, if I refers to the main thread, then " "B() can fail because of errors from various underlying " "calls: B(3), if I can't be opened; and B" "(2), if the B resource limit is not supported." msgstr "" #. type: Plain text #: build/C/man3/pthread_getattr_np.3:96 msgid "This function is available in glibc since version 2.2.3." msgstr "" #. type: Plain text #: build/C/man3/pthread_getattr_np.3:99 #: build/C/man3/pthread_kill_other_threads_np.3:48 msgid "" "This function is a nonstandard GNU extension; hence the suffix \"_np" "\" (nonportable) in the name." msgstr "" #. type: Plain text #: build/C/man3/pthread_getattr_np.3:109 msgid "" "The program below demonstrates the use of B(). The " "program creates a thread that then uses B() to retrieve " "and display its guard size, stack address, and stack size attributes. " "Command-line arguments can be used to set these attributes to values other " "than the default when creating the thread. The shell sessions below " "demonstrate the use of the program." msgstr "" #. type: Plain text #: build/C/man3/pthread_getattr_np.3:112 msgid "" "In the first run, on an x86-32 system, a thread is created using default " "attributes:" msgstr "" #. type: Plain text #: build/C/man3/pthread_getattr_np.3:122 #, no-wrap msgid "" "$B< ulimit -s> # No stack limit ==E default stack size is 2MB\n" "unlimited\n" "$B< ./a.out>\n" "Attributes of created thread:\n" " Guard size = 4096 bytes\n" " Stack address = 0x40196000 (EOS = 0x40397000)\n" " Stack size = 0x201000 (2101248) bytes\n" msgstr "" "$B< ulimit -s> # No stack limit ==E default stack size is 2MB\n" "unlimited\n" "$B< ./a.out>\n" "Attributes of created thread:\n" " Guard size = 4096 bytes\n" " Stack address = 0x40196000 (EOS = 0x40397000)\n" " Stack size = 0x201000 (2101248) bytes\n" #. type: Plain text #: build/C/man3/pthread_getattr_np.3:128 msgid "" "In the following run, we see that if a guard size is specified, it is " "rounded up to the next multiple of the system page size (4096 bytes on " "x86-32):" msgstr "" #. type: Plain text #: build/C/man3/pthread_getattr_np.3:136 #, no-wrap msgid "" "$B< ./a.out -g 4097>\n" "Thread attributes object after initializations:\n" " Guard size = 4097 bytes\n" " Stack address = (nil)\n" " Stack size = 0x0 (0) bytes\n" msgstr "" "$B< ./a.out -g 4097>\n" "Thread attributes object after initializations:\n" " Guard size = 4097 bytes\n" " Stack address = (nil)\n" " Stack size = 0x0 (0) bytes\n" #. type: Plain text #: build/C/man3/pthread_getattr_np.3:141 #, no-wrap msgid "" "Attributes of created thread:\n" " Guard size = 8192 bytes\n" " Stack address = 0x40196000 (EOS = 0x40397000)\n" " Stack size = 0x201000 (2101248) bytes\n" msgstr "" "Attributes of created thread:\n" " Guard size = 8192 bytes\n" " Stack address = 0x40196000 (EOS = 0x40397000)\n" " Stack size = 0x201000 (2101248) bytes\n" #. .in +4n #. .nf #. $ ./a.out \-s 0x8000 #. Thread attributes object after initializations: #. Guard size = 4096 bytes #. Stack address = 0xffff8000 (EOS = (nil)) #. Stack size = 0x8000 (32768) bytes #. Attributes of created thread: #. Guard size = 4096 bytes #. Stack address = 0x4001e000 (EOS = 0x40026000) #. Stack size = 0x8000 (32768) bytes #. .fi #. .in #. type: Plain text #: build/C/man3/pthread_getattr_np.3:160 msgid "" "In the last run, the program manually allocates a stack for the thread. In " "this case, the guard size attribute is ignored." msgstr "" #. type: Plain text #: build/C/man3/pthread_getattr_np.3:165 #, no-wrap msgid "" "$B< ./a.out -g 4096 -s 0x8000 -a>\n" "Allocated thread stack at 0x804d000\n" msgstr "" "$B< ./a.out -g 4096 -s 0x8000 -a>\n" "Allocated thread stack at 0x804d000\n" #. type: Plain text #: build/C/man3/pthread_getattr_np.3:170 #, no-wrap msgid "" "Thread attributes object after initializations:\n" " Guard size = 4096 bytes\n" " Stack address = 0x804d000 (EOS = 0x8055000)\n" " Stack size = 0x8000 (32768) bytes\n" msgstr "" "Thread attributes object after initializations:\n" " Guard size = 4096 bytes\n" " Stack address = 0x804d000 (EOS = 0x8055000)\n" " Stack size = 0x8000 (32768) bytes\n" #. type: Plain text #: build/C/man3/pthread_getattr_np.3:175 #, no-wrap msgid "" "Attributes of created thread:\n" " Guard size = 0 bytes\n" " Stack address = 0x804d000 (EOS = 0x8055000)\n" " Stack size = 0x8000 (32768) bytes\n" msgstr "" "Attributes of created thread:\n" " Guard size = 0 bytes\n" " Stack address = 0x804d000 (EOS = 0x8055000)\n" " Stack size = 0x8000 (32768) bytes\n" #. type: Plain text #: build/C/man3/pthread_getattr_np.3:196 #, no-wrap msgid "" "static void\n" "display_stack_related_attributes(pthread_attr_t *attr, char *prefix)\n" "{\n" " int s;\n" " size_t stack_size, guard_size;\n" " void *stack_addr;\n" msgstr "" "static void\n" "display_stack_related_attributes(pthread_attr_t *attr, char *prefix)\n" "{\n" " int s;\n" " size_t stack_size, guard_size;\n" " void *stack_addr;\n" #. type: Plain text #: build/C/man3/pthread_getattr_np.3:201 #, no-wrap msgid "" " s = pthread_attr_getguardsize(attr, &guard_size);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_attr_getguardsize\");\n" " printf(\"%sGuard size = %d bytes\\en\", prefix, guard_size);\n" msgstr "" " s = pthread_attr_getguardsize(attr, &guard_size);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_attr_getguardsize\");\n" " printf(\"%sGuard size = %d bytes\\en\", prefix, guard_size);\n" #. type: Plain text #: build/C/man3/pthread_getattr_np.3:212 #, no-wrap msgid "" " s = pthread_attr_getstack(attr, &stack_addr, &stack_size);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_attr_getstack\");\n" " printf(\"%sStack address = %p\", prefix, stack_addr);\n" " if (stack_size E 0)\n" " printf(\" (EOS = %p)\", (char *) stack_addr + stack_size);\n" " printf(\"\\en\");\n" " printf(\"%sStack size = 0x%x (%d) bytes\\en\",\n" " prefix, stack_size, stack_size);\n" "}\n" msgstr "" " s = pthread_attr_getstack(attr, &stack_addr, &stack_size);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_attr_getstack\");\n" " printf(\"%sStack address = %p\", prefix, stack_addr);\n" " if (stack_size E 0)\n" " printf(\" (EOS = %p)\", (char *) stack_addr + stack_size);\n" " printf(\"\\en\");\n" " printf(\"%sStack size = 0x%x (%d) bytes\\en\",\n" " prefix, stack_size, stack_size);\n" "}\n" #. type: Plain text #: build/C/man3/pthread_getattr_np.3:218 #, no-wrap msgid "" "static void\n" "display_thread_attributes(pthread_t thread, char *prefix)\n" "{\n" " int s;\n" " pthread_attr_t attr;\n" msgstr "" "static void\n" "display_thread_attributes(pthread_t thread, char *prefix)\n" "{\n" " int s;\n" " pthread_attr_t attr;\n" #. type: Plain text #: build/C/man3/pthread_getattr_np.3:222 #, no-wrap msgid "" " s = pthread_getattr_np(thread, &attr);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_getattr_np\");\n" msgstr "" " s = pthread_getattr_np(thread, &attr);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_getattr_np\");\n" #. type: Plain text #: build/C/man3/pthread_getattr_np.3:224 #, no-wrap msgid " display_stack_related_attributes(&attr, prefix);\n" msgstr " display_stack_related_attributes(&attr, prefix);\n" #. type: Plain text #: build/C/man3/pthread_getattr_np.3:229 #, no-wrap msgid "" " s = pthread_attr_destroy(&attr);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_attr_destroy\");\n" "}\n" msgstr "" " s = pthread_attr_destroy(&attr);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_attr_destroy\");\n" "}\n" #. type: Plain text #: build/C/man3/pthread_getattr_np.3:235 #, no-wrap msgid "" "static void * /* Start function for thread we create */\n" "thread_start(void *arg)\n" "{\n" " printf(\"Attributes of created thread:\\en\");\n" " display_thread_attributes(pthread_self(), \"\\et\");\n" msgstr "" "static void * /* Start function for thread we create */\n" "thread_start(void *arg)\n" "{\n" " printf(\"Attributes of created thread:\\en\");\n" " display_thread_attributes(pthread_self(), \"\\et\");\n" #. type: Plain text #: build/C/man3/pthread_getattr_np.3:249 #, no-wrap msgid "" "static void\n" "usage(char *pname, char *msg)\n" "{\n" " if (msg != NULL)\n" " fputs(msg, stderr);\n" " fprintf(stderr, \"Usage: %s [-s stack-size [-a]]\"\n" " \" [-g guard-size]\\en\", pname);\n" " fprintf(stderr, \"\\et\\et-a means program should allocate stack\\en\");\n" " exit(EXIT_FAILURE);\n" "}\n" msgstr "" "static void\n" "usage(char *pname, char *msg)\n" "{\n" " if (msg != NULL)\n" " fputs(msg, stderr);\n" " fprintf(stderr, \"Usage: %s [-s stack-size [-a]]\"\n" " \" [-g guard-size]\\en\", pname);\n" " fprintf(stderr, \"\\et\\et-a means program should allocate stack\\en\");\n" " exit(EXIT_FAILURE);\n" "}\n" #. type: Plain text #: build/C/man3/pthread_getattr_np.3:262 #, no-wrap msgid "" "static pthread_attr_t * /* Get thread attributes from command line */\n" "get_thread_attributes_from_cl(int argc, char *argv[],\n" " pthread_attr_t *attrp)\n" "{\n" " int s, opt, allocate_stack;\n" " long stack_size, guard_size;\n" " void *stack_addr;\n" " pthread_attr_t *ret_attrp = NULL; /* Set to attrp if we initialize\n" " a thread attributes object */\n" " allocate_stack = 0;\n" " stack_size = -1;\n" " guard_size = -1;\n" msgstr "" "static pthread_attr_t * /* Get thread attributes from command line */\n" "get_thread_attributes_from_cl(int argc, char *argv[],\n" " pthread_attr_t *attrp)\n" "{\n" " int s, opt, allocate_stack;\n" " long stack_size, guard_size;\n" " void *stack_addr;\n" " pthread_attr_t *ret_attrp = NULL; /* Set to attrp if we initialize\n" " a thread attributes object */\n" " allocate_stack = 0;\n" " stack_size = -1;\n" " guard_size = -1;\n" #. type: Plain text #: build/C/man3/pthread_getattr_np.3:271 #, no-wrap msgid "" " while ((opt = getopt(argc, argv, \"ag:s:\")) != -1) {\n" " switch (opt) {\n" " case \\(aqa\\(aq: allocate_stack = 1; break;\n" " case \\(aqg\\(aq: guard_size = strtoul(optarg, NULL, 0); break;\n" " case \\(aqs\\(aq: stack_size = strtoul(optarg, NULL, 0); break;\n" " default: usage(argv[0], NULL);\n" " }\n" " }\n" msgstr "" " while ((opt = getopt(argc, argv, \"ag:s:\")) != -1) {\n" " switch (opt) {\n" " case \\(aqa\\(aq: allocate_stack = 1; break;\n" " case \\(aqg\\(aq: guard_size = strtoul(optarg, NULL, 0); break;\n" " case \\(aqs\\(aq: stack_size = strtoul(optarg, NULL, 0); break;\n" " default: usage(argv[0], NULL);\n" " }\n" " }\n" #. type: Plain text #: build/C/man3/pthread_getattr_np.3:274 #, no-wrap msgid "" " if (allocate_stack && stack_size == -1)\n" " usage(argv[0], \"Specifying -a without -s makes no sense\\en\");\n" msgstr "" " if (allocate_stack && stack_size == -1)\n" " usage(argv[0], \"Specifying -a without -s makes no sense\\en\");\n" #. type: Plain text #: build/C/man3/pthread_getattr_np.3:277 #, no-wrap msgid "" " if (argc E optind)\n" " usage(argv[0], \"Extraneous command-line arguments\\en\");\n" msgstr "" " if (argc E optind)\n" " usage(argv[0], \"Extraneous command-line arguments\\en\");\n" #. type: Plain text #: build/C/man3/pthread_getattr_np.3:280 #, no-wrap msgid "" " if (stack_size E= 0 || guard_size E 0) {\n" " ret_attrp = attrp;\n" msgstr "" " if (stack_size E= 0 || guard_size E 0) {\n" " ret_attrp = attrp;\n" #. type: Plain text #: build/C/man3/pthread_getattr_np.3:285 #, no-wrap msgid "" " s = pthread_attr_init(attrp);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_attr_init\");\n" " }\n" msgstr "" " s = pthread_attr_init(attrp);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_attr_init\");\n" " }\n" #. type: Plain text #: build/C/man3/pthread_getattr_np.3:297 #, no-wrap msgid "" " if (stack_size E= 0) {\n" " if (!allocate_stack) {\n" " s = pthread_attr_setstacksize(attrp, stack_size);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_attr_setstacksize\");\n" " } else {\n" " s = posix_memalign(&stack_addr, sysconf(_SC_PAGESIZE),\n" " stack_size);\n" " if (s != 0)\n" " handle_error_en(s, \"posix_memalign\");\n" " printf(\"Allocated thread stack at %p\\en\\en\", stack_addr);\n" msgstr "" " if (stack_size E= 0) {\n" " if (!allocate_stack) {\n" " s = pthread_attr_setstacksize(attrp, stack_size);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_attr_setstacksize\");\n" " } else {\n" " s = posix_memalign(&stack_addr, sysconf(_SC_PAGESIZE),\n" " stack_size);\n" " if (s != 0)\n" " handle_error_en(s, \"posix_memalign\");\n" " printf(\"Allocated thread stack at %p\\en\\en\", stack_addr);\n" #. type: Plain text #: build/C/man3/pthread_getattr_np.3:303 #, no-wrap msgid "" " s = pthread_attr_setstack(attrp, stack_addr, stack_size);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_attr_setstacksize\");\n" " }\n" " }\n" msgstr "" " s = pthread_attr_setstack(attrp, stack_addr, stack_size);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_attr_setstacksize\");\n" " }\n" " }\n" #. type: Plain text #: build/C/man3/pthread_getattr_np.3:309 #, no-wrap msgid "" " if (guard_size E= 0) {\n" " s = pthread_attr_setguardsize(attrp, guard_size);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_attr_setstacksize\");\n" " }\n" msgstr "" " if (guard_size E= 0) {\n" " s = pthread_attr_setguardsize(attrp, guard_size);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_attr_setstacksize\");\n" " }\n" #. type: Plain text #: build/C/man3/pthread_getattr_np.3:312 #, no-wrap msgid "" " return ret_attrp;\n" "}\n" msgstr "" " return ret_attrp;\n" "}\n" #. type: Plain text #: build/C/man3/pthread_getattr_np.3:321 #, no-wrap msgid "" "int\n" "main(int argc, char *argv[])\n" "{\n" " int s;\n" " pthread_t thr;\n" " pthread_attr_t attr;\n" " pthread_attr_t *attrp = NULL; /* Set to &attr if we initialize\n" " a thread attributes object */\n" msgstr "" "int\n" "main(int argc, char *argv[])\n" "{\n" " int s;\n" " pthread_t thr;\n" " pthread_attr_t attr;\n" " pthread_attr_t *attrp = NULL; /* Set to &attr if we initialize\n" " a thread attributes object */\n" #. type: Plain text #: build/C/man3/pthread_getattr_np.3:323 #, no-wrap msgid " attrp = get_thread_attributes_from_cl(argc, argv, &attr);\n" msgstr " attrp = get_thread_attributes_from_cl(argc, argv, &attr);\n" #. type: Plain text #: build/C/man3/pthread_getattr_np.3:329 #, no-wrap msgid "" " if (attrp != NULL) {\n" " printf(\"Thread attributes object after initializations:\\en\");\n" " display_stack_related_attributes(attrp, \"\\et\");\n" " printf(\"\\en\");\n" " }\n" msgstr "" " if (attrp != NULL) {\n" " printf(\"Thread attributes object after initializations:\\en\");\n" " display_stack_related_attributes(attrp, \"\\et\");\n" " printf(\"\\en\");\n" " }\n" #. type: Plain text #: build/C/man3/pthread_getattr_np.3:356 msgid "" "B(3), B(3), " "B(3), B(3), " "B(3), B(3), " "B(3), B(3), " "B(3), B(3), " "B(3), B(3), B(7)" msgstr "" "B(3), B(3), " "B(3), B(3), " "B(3), B(3), " "B(3), B(3), " "B(3), B(3), " "B(3), B(3), B(7)" #. type: TH #: build/C/man3/pthread_getcpuclockid.3:24 #, no-wrap msgid "PTHREAD_GETCPUCLOCKID" msgstr "PTHREAD_GETCPUCLOCKID" #. type: TH #: build/C/man3/pthread_getcpuclockid.3:24 #, no-wrap msgid "2009-02-08" msgstr "2009-02-08" #. type: Plain text #: build/C/man3/pthread_getcpuclockid.3:27 msgid "pthread_getcpuclockid - retrieve ID of a thread's CPU time clock" msgstr "" #. type: Plain text #: build/C/man3/pthread_getcpuclockid.3:31 #, no-wrap msgid "" "B<#include Epthread.hE>\n" "B<#include Etime.hE>\n" msgstr "" "B<#include Epthread.hE>\n" "B<#include Etime.hE>\n" #. type: Plain text #: build/C/man3/pthread_getcpuclockid.3:33 #, no-wrap msgid "BIB<, clockid_t *>I\n" msgstr "BIB<, clockid_t *>I\n" #. The clockid is constructed as follows: #. *clockid = CLOCK_THREAD_CPUTIME_ID | (pd->tid << CLOCK_IDFIELD_SIZE) #. where CLOCK_IDFIELD_SIZE is 3. #. type: Plain text #: build/C/man3/pthread_getcpuclockid.3:44 msgid "" "The B() function returns the clock ID for the CPU " "time clock of the thread I." msgstr "" #. type: TP #: build/C/man3/pthread_getcpuclockid.3:48 #, no-wrap msgid "B" msgstr "B" #. CLOCK_THREAD_CPUTIME_ID not defined #. Looking at nptl/pthread_getcpuclockid.c an ERANGE error would #. be possible if kernel thread IDs took more than 29 bits (which #. they currently cannot). #. type: Plain text #: build/C/man3/pthread_getcpuclockid.3:56 msgid "Per-thread CPU time clocks are not supported by the system." msgstr "" #. type: Plain text #: build/C/man3/pthread_getcpuclockid.3:63 msgid "This function is available in glibc since version 2.2." msgstr "" #. type: Plain text #: build/C/man3/pthread_getcpuclockid.3:76 msgid "" "When I refers to the calling thread, this function returns an " "identifier that refers to the same clock manipulated by B(2) " "and B(2) when given the clock ID B." msgstr "" #. type: Plain text #: build/C/man3/pthread_getcpuclockid.3:82 msgid "" "The program below creates a thread and then uses B(2) to " "retrieve the total process CPU time, and the per-thread CPU time consumed by " "the two threads. The following shell session shows an example run:" msgstr "" #. type: Plain text #: build/C/man3/pthread_getcpuclockid.3:91 #, no-wrap msgid "" "$ B<./a.out>\n" "Main thread sleeping\n" "Subthread starting infinite loop\n" "Main thread consuming some CPU time...\n" "Process total CPU time: 1.368\n" "Main thread CPU time: 0.376\n" "Subthread CPU time: 0.992\n" msgstr "" "$ B<./a.out>\n" "Main thread sleeping\n" "Subthread starting infinite loop\n" "Main thread consuming some CPU time...\n" "Process total CPU time: 1.368\n" "Main thread CPU time: 0.376\n" "Subthread CPU time: 0.992\n" #. type: Plain text #: build/C/man3/pthread_getcpuclockid.3:97 #, no-wrap msgid "/* Link with \"-lrt\" */\n" msgstr "" #. type: Plain text #: build/C/man3/pthread_getcpuclockid.3:105 #, no-wrap msgid "" "#include Etime.hE\n" "#include Estdio.hE\n" "#include Estdlib.hE\n" "#include Eunistd.hE\n" "#include Epthread.hE\n" "#include Estring.hE\n" "#include Eerrno.hE\n" msgstr "" "#include Etime.hE\n" "#include Estdio.hE\n" "#include Estdlib.hE\n" "#include Eunistd.hE\n" "#include Epthread.hE\n" "#include Estring.hE\n" "#include Eerrno.hE\n" #. type: Plain text #: build/C/man3/pthread_getcpuclockid.3:119 #, no-wrap msgid "" "static void *\n" "thread_start(void *arg)\n" "{\n" " printf(\"Subthread starting infinite loop\\en\");\n" " for (;;)\n" " continue;\n" "}\n" msgstr "" "static void *\n" "thread_start(void *arg)\n" "{\n" " printf(\"Subthread starting infinite loop\\en\");\n" " for (;;)\n" " continue;\n" "}\n" #. type: Plain text #: build/C/man3/pthread_getcpuclockid.3:124 #, no-wrap msgid "" "static void\n" "pclock(char *msg, clockid_t cid)\n" "{\n" " struct timespec ts;\n" msgstr "" "static void\n" "pclock(char *msg, clockid_t cid)\n" "{\n" " struct timespec ts;\n" #. type: Plain text #: build/C/man3/pthread_getcpuclockid.3:130 #, no-wrap msgid "" " printf(\"%s\", msg);\n" " if (clock_gettime(cid, &ts) == -1)\n" " handle_error(\"clock_gettime\");\n" " printf(\"%4ld.%03ld\\en\", ts.tv_sec, ts.tv_nsec / 1000000);\n" "}\n" msgstr "" " printf(\"%s\", msg);\n" " if (clock_gettime(cid, &ts) == -1)\n" " handle_error(\"clock_gettime\");\n" " printf(\"%4ld.%03ld\\en\", ts.tv_sec, ts.tv_nsec / 1000000);\n" "}\n" #. type: Plain text #: build/C/man3/pthread_getcpuclockid.3:137 #, no-wrap msgid "" "int\n" "main(int argc, char *argv[])\n" "{\n" " pthread_t thread;\n" " clockid_t cid;\n" " int j, s;\n" msgstr "" "int\n" "main(int argc, char *argv[])\n" "{\n" " pthread_t thread;\n" " clockid_t cid;\n" " int j, s;\n" #. type: Plain text #: build/C/man3/pthread_getcpuclockid.3:141 #, no-wrap msgid "" " s = pthread_create(&thread, NULL, thread_start, NULL);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_create\");\n" msgstr "" " s = pthread_create(&thread, NULL, thread_start, NULL);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_create\");\n" #. type: Plain text #: build/C/man3/pthread_getcpuclockid.3:144 #, no-wrap msgid "" " printf(\"Main thread sleeping\\en\");\n" " sleep(1);\n" msgstr "" " printf(\"Main thread sleeping\\en\");\n" " sleep(1);\n" #. type: Plain text #: build/C/man3/pthread_getcpuclockid.3:148 #, no-wrap msgid "" " printf(\"Main thread consuming some CPU time...\\en\");\n" " for (j = 0; j E 2000000; j++)\n" " getppid();\n" msgstr "" " printf(\"Main thread consuming some CPU time...\\en\");\n" " for (j = 0; j E 2000000; j++)\n" " getppid();\n" #. type: Plain text #: build/C/man3/pthread_getcpuclockid.3:150 #, no-wrap msgid " pclock(\"Process total CPU time: \", CLOCK_PROCESS_CPUTIME_ID);\n" msgstr " pclock(\"Process total CPU time: \", CLOCK_PROCESS_CPUTIME_ID);\n" #. type: Plain text #: build/C/man3/pthread_getcpuclockid.3:155 #, no-wrap msgid "" " s = pthread_getcpuclockid(pthread_self(), &cid);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_getcpuclockid\");\n" " pclock(\"Main thread CPU time: \", cid);\n" msgstr "" " s = pthread_getcpuclockid(pthread_self(), &cid);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_getcpuclockid\");\n" " pclock(\"Main thread CPU time: \", cid);\n" #. type: Plain text #: build/C/man3/pthread_getcpuclockid.3:158 #, no-wrap msgid "" " /* The preceding 4 lines of code could have been replaced by:\n" " pclock(\"Main thread CPU time: \", CLOCK_THREAD_CPUTIME_ID); */\n" msgstr "" " /* The preceding 4 lines of code could have been replaced by:\n" " pclock(\"Main thread CPU time: \", CLOCK_THREAD_CPUTIME_ID); */\n" #. type: Plain text #: build/C/man3/pthread_getcpuclockid.3:163 #, no-wrap msgid "" " s = pthread_getcpuclockid(thread, &cid);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_getcpuclockid\");\n" " pclock(\"Subthread CPU time: 1 \", cid);\n" msgstr "" " s = pthread_getcpuclockid(thread, &cid);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_getcpuclockid\");\n" " pclock(\"Subthread CPU time: 1 \", cid);\n" #. type: Plain text #: build/C/man3/pthread_getcpuclockid.3:166 #, no-wrap msgid "" " exit(EXIT_SUCCESS); /* Terminates both threads */\n" "}\n" msgstr "" " exit(EXIT_SUCCESS); /* Terminates both threads */\n" "}\n" #. type: Plain text #: build/C/man3/pthread_getcpuclockid.3:174 msgid "" "B(2), B(2), B(2), " "B(3), B(3), B(7), B