Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

      tss_delete

      From cppreference.com
      <c‎ |thread
       
       
      Concurrency support library
       
      Defined in header<threads.h>
      void tss_delete(tss_t tss_id);
      (since C11)

      Destroys the thread-specific storage identified bytss_id.

      The destructor, if one was registered bytss_create, is not called (they are only called at thread exit, either bythrd_exit or by returning from the thread function), it is the responsibility of the programmer to ensure that every thread that is aware oftss_id performed all necessary cleanup, before the call totss_delete is made.

      Iftss_delete is called while another thread is executing destructors fortss_id, it's unspecified whether this changes the number of invocations to the associated destructor.

      Iftss_delete is called while the calling thread is executing destructors, then the destructor associated withtss_id will not be executed again on this thread.

      Contents

      [edit]Parameters

      tss_id - thread-specific storage key previously returned bytss_create and not yet deleted bytss_delete

      [edit]Return value

      (none)

      [edit]Notes

      The POSIX equivalent of this function ispthread_key_delete.

      The reasontss_delete never calls destructors is that the destructors (called at thread exit) are normally intended to be executed by the same thread that originally set the value (viatss_set) that the destructor will be dealing with, and may even rely on the values of that or other thread-specific data as seen by that thread. The thread executingtss_delete has no access to other threads' TSS. Even if it were possible to call the destructor for each thread's own value associated withtss_id,tss_delete would have to synchronize with every thread if only to examine whether the value of this TSS in that thread is null (destructors are only called against non-null values).

      [edit]Example

      This section is incomplete
      Reason: no example

      [edit]References

      • C17 standard (ISO/IEC 9899:2018):
      • 7.26.6.2 The tss_delete function (p: 282)
      • C11 standard (ISO/IEC 9899:2011):
      • 7.26.6.2 The tss_delete function (p: 386)
      Retrieved from "https://en.cppreference.com/mwiki/index.php?title=c/thread/tss_delete&oldid=138759"

      [8]ページ先頭

      ©2009-2025 Movatter.jp