[perldocjp-cvs 1348] CVS update: docs/modules/threads-1.67

アーカイブの一覧に戻る

argra****@users***** argra****@users*****
2011年 9月 9日 (金) 04:46:56 JST


Index: docs/modules/threads-1.67/threads.pod
diff -u docs/modules/threads-1.67/threads.pod:1.3 docs/modules/threads-1.67/threads.pod:1.4
--- docs/modules/threads-1.67/threads.pod:1.3	Sun Jul 19 03:18:08 2009
+++ docs/modules/threads-1.67/threads.pod	Fri Sep  9 04:46:56 2011
@@ -586,10 +586,8 @@
 
 =end original
 
-The usual method for terminating a thread is to
-L<return()|perlfunc/"return EXPR"> from the entry point function with the
-appropriate return value(s).
-(TBT)
+スレッドを終了するための通常の手法は、エントリポイント関数で
+適切な返り値と共に L<return()|perlfunc/"return EXPR"> を使うことです。
 
 =over
 
@@ -663,11 +661,11 @@
 
 =end original
 
-Calling L<exit()|perlfunc/"exit EXPR"> inside a thread causes the whole
-application to terminate.  Because of this, the use of C<exit()> inside
-threaded code, or in modules that might be used in threaded applications, is
-strongly discouraged.
-(TBT)
+スレッドの内部で L<exit()|perlfunc/"exit EXPR"> を呼び出すと、
+アプリケーション全体が終了します。
+これのことにより、スレッドコード内部や、スレッド化された
+アプリケーションで使われるかも知れないモジュールでの C<exit()> の使用は
+強く非推奨です。
 
 =begin original
 
@@ -691,11 +689,11 @@
 
 =end original
 
-This globally overrides the default behavior of calling C<exit()> inside a
-thread, and effectively causes such calls to behave the same as
-C<threads-E<gt>exit()>.  In other words, with this setting, calling C<exit()>
-causes only the thread to terminate.
-(TBT)
+これはスレッド内での C<exit()> 呼び出しのデフォルトの振る舞いをグローバルに
+上書きし、事実上このような呼び出しを C<threads-E<gt>exit()> と同じ
+振る舞いにします。
+言い換えると、この設定によって、C<exit()> を呼び出したときにスレッドだけを
+終了させます。
 
 =begin original
 
@@ -704,9 +702,8 @@
 
 =end original
 
-Because of its global effect, this setting should not be used inside modules
-or the like.
-(TBT)
+これはグローバルな効果を持つので、この設定はモジュールのようなものの内部では
+使うべきではありません。
 
 =begin original
 
@@ -714,8 +711,7 @@
 
 =end original
 
-The I<main> thread is unaffected by this setting.
-(TBT)
+I<main> スレッドはこの設定の影響を受けません。
 
 =item threads->create({'exit' => 'thread_only'}, ...)
 
@@ -726,9 +722,8 @@
 
 =end original
 
-This overrides the default behavior of C<exit()> inside the newly created
-thread only.
-(TBT)
+これは新しく作られたスレッドの内側でだけ C<exit()> のデフォルトの
+振る舞いを上書きします。
 
 =item $thr->set_thread_exit_only(boolean)
 
@@ -741,11 +736,10 @@
 
 =end original
 
-This can be used to change the I<exit thread only> behavior for a thread after
-it has been created.  With a I<true> argument, C<exit()> will cause only the
-thread to exit.  With a I<false> argument, C<exit()> will terminate the
-application.
-(TBT)
+これは、スレッドの I<スレッドだけ終了> の振る舞いを、スレッドが作られた
+後で変更するために使われます。
+I<真> の値を渡すと、C<exit()> によってスレッドだけが終了します。
+I<偽> の値を渡すと、C<exit()> によってアプリケーションが終了します。
 
 =begin original
 
@@ -753,8 +747,7 @@
 
 =end original
 
-The I<main> thread is unaffected by this call.
-(TBT)
+I<main> スレッドはこの呼び出しの影響を受けません。
 
 =item threads->set_thread_exit_only(boolean)
 
@@ -764,8 +757,8 @@
 
 =end original
 
-Class method for use inside a thread to change its own behavior for C<exit()>.
-(TBT)
+C<exit()> の振る舞いを変えるためにスレッドの内側で使うための
+クラスメソッドです。
 
 =begin original
 
@@ -773,8 +766,7 @@
 
 =end original
 
-The I<main> thread is unaffected by this call.
-(TBT)
+I<main> スレッドはこの呼び出しの影響を受けません。
 
 =back
 
@@ -838,7 +830,7 @@
 =end original
 
 スレッドが detach されているかどうかを決定できるようにするための
-クラスメソッド。
+クラスメソッドです。
 
 =back
 
@@ -857,13 +849,13 @@
 
 =end original
 
-As with subroutines, the type of value returned from a thread's entry point
-function may be determined by the thread's I<context>:  list, scalar or void.
-The thread's context is determined at thread creation.  This is necessary so
-that the context is available to the entry point function via
-L<wantarray()|perlfunc/"wantarray">.  The thread may then specify a value of
-the appropriate type to be returned from C<-E<gt>join()>.
-(TBT)
+サブルーチンと同様、スレッドのエントリポイント関数から返される値の型は
+スレッドの I<コンテキスト> (リスト、スカラ、無効のいずれか) によって
+決定されます。
+スレッドのコンテキストはスレッド作成時に決定されます。
+これは、コンテキストをエントリポイント関数から
+L<wantarray()|perlfunc/"wantarray"> を使って利用可能にするために必要です。
+それからスレッドは C<-E<gt>join()> から返される適切な型の値を指定します。
 
 =head2 Explicit context
 
@@ -878,11 +870,11 @@
 
 =end original
 
-Because thread creation and thread joining may occur in different contexts, it
-may be desirable to state the context explicitly to the thread's entry point
-function.  This may be done by calling C<-E<gt>create()> with a hash reference
-as the first argument:
-(TBT)
+スレッドの作成とスレッドの join は異なったコンテキストで
+行われるかもしれないので、スレッドのエントリポイント関数で明示的に
+コンテキストを宣言することが望ましいです。
+これは最初の引数としてハッシュリファレンスを指定した C<-E<gt>create()> を
+呼び出すことで行えます:
 
     my $thr = threads->create({'context' => 'list'}, \&foo);
     ...
@@ -897,11 +889,11 @@
 
 =end original
 
-In the above, the threads object is returned to the parent thread in scalar
-context, and the thread's entry point function C<foo> will be called in list
-(array) context such that the parent thread can receive a list (array) from
-the C<-E<gt>join()> call.  (C<'array'> is synonymous with C<'list'>.)
-(TBT)
+上述の場合、スレッドオブジェクトは親スレッドにスカラコンテキストで
+返され、スレッドのエントリポイント関数 C<foo> はリスト(配列)コンテキストで
+予備されるので、親スレッドは C<-E<gt>join()> 呼び出しからリスト(配列)を
+受け取ります。
+(C<'array'> は C<'list'> の同義語です。)
 
 =begin original
 
@@ -910,9 +902,8 @@
 
 =end original
 
-Similarly, if you need the threads object, but your thread will not be
-returning a value (i.e., I<void> context), you would do the following:
-(TBT)
+同様に、もしスレッドオブジェクトが必要だけれども、スレッドが値を返さない
+(つまり I<無効> コンテキスト) 場合、以下のようにします:
 
     my $thr = threads->create({'context' => 'void'}, \&foo);
     ...
@@ -925,9 +916,8 @@
 
 =end original
 
-The context type may also be used as the I<key> in the hash reference followed
-by a I<true> value:
-(TBT)
+コンテキスト型はまた、ハッシュリファレンスの I<キー> に引き続いて I<真> の
+値としても使えます:
 
     threads->create({'scalar' => 1}, \&foo);
     ...
@@ -997,12 +987,11 @@
 
 =end original
 
-The default per-thread stack size for different platforms varies
-significantly, and is almost always far more than is needed for most
-applications.  On Win32, Perl's makefile explicitly sets the default stack to
-16 MB; on most other platforms, the system default is used, which again may be
-much larger than is needed.
-(TBT)
+デフォルトのスレッド毎のスタックサイズはプラットフォームによって大きく異なり、
+ほとんど常にほとんどのアプリケーションが必要な量よりはるかに多いです。
+Win32 では、Perl の makefile は明示的にデフォルトのスタックを 16 MB に
+指定しています; その他のほとんどのシステムでは、システムのデフォルトが
+使われますが、やはり必要な量よりはるかに多いです。
 
 =begin original
 
@@ -1012,10 +1001,9 @@
 
 =end original
 
-By tuning the stack size to more accurately reflect your application's needs,
-you may significantly reduce your application's memory usage, and increase the
-number of simultaneously running threads.
-(TBT)
+スタックサイズをアプリケーションのニーズにより正確に反映させることにより、
+アプリケーションのメモリ使用量を著しく減少させ、同時実行スレッド数を
+増やすことができるかもしれません。
 
 =begin original
 
@@ -1025,10 +1013,9 @@
 
 =end original
 
-Note that on Windows, address space allocation granularity is 64 KB,
-therefore, setting the stack smaller than that on Win32 Perl will not save any
-more memory.
-(TBT)
+従って、アドレス空間配置の粒度が 64 KB である Windows では、Win32 Perl で
+これより小さい値にスタックを設定してもメモリを節約できないことに
+注意してください。
 
 =over
 
@@ -1041,9 +1028,9 @@
 
 =end original
 
-Returns the current default per-thread stack size.  The default is zero, which
-means the system default stack size is currently in use.
-(TBT)
+現在のデフォルトのスレッド毎のスタックサイズを返します。
+デフォルトは 0 で、これはシステムのデフォルトスタックサイズを
+使っていることを示します。
 
 =item $size = $thr->get_stack_size();
 
@@ -1066,8 +1053,8 @@
 
 =end original
 
-Sets a new default per-thread stack size, and returns the previous setting.
-(TBT)
+新しいデフォルトのスレッド毎のスタックサイズを設定し、以前の設定を
+返します。
 
 =begin original
 
@@ -1123,8 +1110,7 @@
 
 =end original
 
-(Obviously, this call does not affect any currently extant threads.)
-(TBT)
+(明らかに、この呼び出しは既に存在するスレッドには影響を与えません。)
 
 =item use threads ('stack_size' => VALUE);
 
@@ -1134,8 +1120,8 @@
 
 =end original
 
-This sets the default per-thread stack size at the start of the application.
-(TBT)
+これはアプリケーションの開始時にスタック単位のデフォルトのスタックサイズを
+設定します。
 
 =item $ENV{'PERL5_ITHREADS_STACK_SIZE'}
 
@@ -1242,8 +1228,7 @@
 
 =end original
 
-Returns the thread object to allow for method chaining:
-(TBT)
+メソッドチェーンができるように、スレッドオブジェクトを返します:
 
     $thr->kill('SIG...')->join();
 
@@ -1376,8 +1361,7 @@
 
 =end original
 
-Sending a signal to a terminated thread is ignored.
-(TBT)
+終了したスレッドへのシグナル送信は無視されます。
 
 =head1 WARNINGS
 
@@ -1473,8 +1457,7 @@
 
 =end original
 
-If needed, thread warnings can be suppressed by using:
-(TBT)
+もし必要なら、スレッドの警告は以下のものを:
 
     no warnings 'threads';
 
@@ -1484,8 +1467,7 @@
 
 =end original
 
-in the appropriate scope.
-(TBT)
+適切なスコープで使うことで抑制できます。
 
 =head1 ERRORS
 



perldocjp-cvs メーリングリストの案内
アーカイブの一覧に戻る