.\" Copyright (c) 1996 John Birrell . .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" 3. All advertising materials mentioning features or use of this software .\" must display the following acknowledgement: .\" This product includes software developed by John Birrell. .\" 4. Neither the name of the author nor the names of any co-contributors .\" may be used to endorse or promote products derived from this software .\" without specific prior written permission. .\" .\" THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" .\" %FreeBSD: src/lib/libc_r/man/pthread_exit. 3, v 1.8. 2.7 2001/12/17 10:08:26 ru Exp % .\" .\" $FreeBSD: doc/ja_JP.eucJP/man/man3/pthread_exit. 3, v 1.6 2002/08/29 02:13:34 horikawa Exp $ .Dd April 4, 1996 .Dt PTHREAD_EXIT 3 .Os .Sh ¸íĪ .Nm pthread_exit .Nd È£ÃâÇϰí ÀÖ´Â threadÀÇ Á¾·á .Sh ÇÁ·Î±×·¥ ¶óÀ̺귯¸® .Lb libc_r .Sh ¼­½Ä .In pthread.h .Ft void .Fn pthread_exit "void *value_ptr" .Sh ÇØ¼³ .Fn pthread_exit ÇÔ¼ö´Â, È£ÃâÇϰí ÀÖ´Â thread¸¦ Á¾·áÇØ, Á¾·áÇÏ´Â thread¿Í ¼º°ø¸®¿¡ ±â´Ù¸®°í Çϱâ À§Çؼ­ .Fa value_ptr ÀÇ °ªÀ» ÀÌ¿ë °¡´ÉÇÏ°Ô ÇÕ´Ï´Ù. ÀÌ¹Ì ½ºÅÿ¡ ½×¿© ÀÖ¾î ²¨³»ÁöÁö ¾ÊÀº Ãë¼Ò Ŭ¸° ¾÷ Çڵ鷯´Â, ½×¾ÆÁø °Í°ú ¿ªÀÇ ¼ø¼­·Î ²¨³»Á® ½ÇÇàµË´Ï´Ù. ¸ðµç Ãë¼Ò Çڵ鷯°¡ ½ÇÇàµÈ ´ÙÀ½¿¡, thread°¡ ±× thread °íÀ¯ÀÇ µ¥ÀÌÅ͸¦ °¡Áö°í ÀÖ´Â °æ¿ì¿¡´Â, ÀûÀýÇÑ ¼Ò¸êÀÚ ÇÔ¼ö°¡ ¼ø¼­ ºÎÁ¤À¸·Î ºÒ·Á °©´Ï´Ù. threadÀÇ Á¾·á´Â, ¾îÇø®ÄÉÀ̼ÇÀ¸·ÎºÎÅÍ º¸ÀÌ´Â ¸ðµç ÇÁ·Î¼¼½º ¸®¼Ò½º¸¦ ÇØ¹æÇÏÁö ¾Ê½À´Ï´Ù. ÀÌ ¸®¼Ò½º´Â, mutex ¹× ÆÄÀÏ ±â¼úÀÚ¸¦ Æ÷ÇÔÇÕ´Ï´Ù¸¸, À̰Ϳ¡ ÇÑÁ¤ÇÏÁö ¾Ê½À´Ï´Ù. ¶Ç, ¸ðµç ÇÁ·Î¼¼½º ·¹º§ÀÇ Å¬¸° ¾÷ÀÇ ½ÇÇ൵ ÇàÇÏÁö ¾Ê½À´Ï´Ù. ÀÌ Å¬¸° ¾÷Àº, Á¸ÀçÇÒ °¡´É¼ºÀÌ ÀÖ´Ù .Fn atexit routineÀÇ È£ÃâÀ» Æ÷ÇÔÇÕ´Ï´Ù¸¸, À̰Ϳ¡ ÇÑÁ¤ÇÏÁö ¾Ê½À´Ï´Ù. .Pp .Fn main (À»)¸¦ ÃÖÃÊ·Î ½ÇÇàÇÑ thread ÀÌ¿ÜÀÇ thread°¡, ±× ÀÛ¼º¿¡ »ç¿ëµÇ¾ú´Ù °³½Ã routine·ÎºÎÅÍ µ¹¾Æ¿ÔÀ» ¶§¿¡, ¾Ï¹¬ÀûÀ¸·Î .Fn pthread_exit ÇÏÁö¸¸ ºÒ·Á °©´Ï´Ù. ÇÔ¼öÀÇ ¹Ýȯ°ªÀº, threadÀÇ Á¾·á ½ºÅ×ÀÌÅͽº·Î¼­ »ç¿ëµË´Ï´Ù. .Pp ¾Ï¹¬ÀûÀÎ ¶Ç´Â ¸í½ÃÀûÀÎ .Fn pthread_exit ÀÇ È£ÃâÀÇ °á°ú·Î¼­ ½ÇÇàµÈ Ãë¼Ò Çڵ鷯 ¶Ç´Â ¼Ò¸êÀÚ ÇÔ¼ö·ÎºÎÅÍ ºÒ·Á °¬À» °æ¿ìÀÇ, .Fn pthread_exit ÀÇ µ¿ÀÛÀº ¹ÌÁ¤µµ¸®ÀÔ´Ï´Ù. .Pp thread°¡ Á¾·áÇÑ ´ÙÀ½¿¡ÀÇ, ±× threadÀÇ ·ÎÄà (auto) º¯¼ö¿¡ÀÇ ¾×¼¼½ºÀÇ °á°ú´Â ¹ÌÁ¤µµ¸®ÀÔ´Ï´Ù. µû¶ó¼­, Á¾·áÇÏ´Â threadÀÇ ·ÎÄà º¯¼ö¿¡ÀÇ ÂüÁ¶´Â, .Fn pthread_exit ÀÇ .Fa value_ptr ÆÄ¶ó¹ÌÅÍÀÇ °ª¿¡ »ç¿ëµÇ¾î¾ß ÇÏ´Â °ÍÀÌ ¾Æ´Õ´Ï´Ù. .Pp ¸¶Áö¸· thread°¡ Á¾·áÇÑ ´ÙÀ½¿¡, ÇÁ·Î¼¼½º´Â Á¾·á ½ºÅ×ÀÌÅͽº 0 À¸·Î Á¾·áÇÕ´Ï´Ù. thread Á¾·á½Ã¿¡ ½ÇÀåÀÌ Àμö 0 À¸·Î .Fn exit (À»)¸¦ È£ÃâÇß´ÂÁö¿Í °°ÀÌ µ¿ÀÛÇÕ´Ï´Ù. .Pp .Sh ¹Ýȯ°ª .Fn pthread_exit ÇÔ¼ö´Â È£ÃâÇØ Ãø¿¡´Â µ¹¾Æ¿Ã ¼ö ¾ø½À´Ï´Ù. .Sh ¿¡·¯ ¾ø½À´Ï´Ù. .Pp .Sh °ü·Ã Ç׸ñ .Xr _exit 2 , .Xr exit 3 , .Xr pthread_create 3 , .Xr pthread_join 3 .Sh Ç¥ÁØ .Fn pthread_exit ÇÏ .St -p1003.1-96 ¿¡ ÀûÇÕÇϰí ÀÖ½À´Ï´Ù.