Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

      thrd_exit

      From cppreference.com
      <c‎ |thread
       
       
      Concurrency support library
       
      Defined in header<threads.h>
      _Noreturnvoid thrd_exit(int res);
      (since C11)
      (until C23)
      [[noreturn]]void thrd_exit(int res);
      (since C23)

      First, for every thread-specific storage key which was created with a non-null destructor and for which the associated value is non-null (seetss_create),thrd_exit sets the value associated with the key toNULL and then invokes the destructor with the previous value of the key. The order in which the destructors are invoked is unspecified.

      If, after this, there remain keys with both non-null destructors and values (e.g. if a destructor executedtss_set), the process is repeated up toTSS_DTOR_ITERATIONS times.

      Finally, thethrd_exit function terminates execution of the calling thread and sets its result code tores.

      If the last thread in the program is terminated withthrd_exit, the entire program terminates as if by callingexit withEXIT_SUCCESS as the argument (so the functions registered byatexit are executed in the context of that last thread)

      Contents

      [edit]Parameters

      res - the result value to return

      [edit]Return value

      (none)

      [edit]References

      • C17 standard (ISO/IEC 9899:2018):
      • 7.26.5.5 The thrd_exit function (p: 280)
      • C11 standard (ISO/IEC 9899:2011):
      • 7.26.5.5 The thrd_exit function (p: 384)

      [edit]See also

      blocks until a thread terminates
      (function)[edit]
      detaches a thread
      (function)[edit]
      Retrieved from "https://en.cppreference.com/mwiki/index.php?title=c/thread/thrd_exit&oldid=154420"

      [8]ページ先頭

      ©2009-2025 Movatter.jp