Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

      cnd_wait

      From cppreference.com
      <c‎ |thread
       
       
      Concurrency support library
       
      Defined in header<threads.h>
      int cnd_wait(cnd_t* cond,mtx_t* mutex);
      (since C11)

      Atomically unlocks the mutex pointed to bymutex and blocks on the condition variable pointed to bycond until the thread is signalled bycnd_signal orcnd_broadcast, or until a spurious wake-up occurs. The mutex is locked again before the function returns.

      The behavior is undefined if the mutex is not already locked by the calling thread.

      Contents

      [edit]Parameters

      cond - pointer to the condition variable to block on
      mutex - pointer to the mutex to unlock for the duration of the block

      [edit]Return value

      thrd_success if successful,thrd_error otherwise.

      [edit]References

      • C17 standard (ISO/IEC 9899:2018):
      • 7.26.3.6 The cnd_wait function (p: 277)
      • C11 standard (ISO/IEC 9899:2011):
      • 7.26.3.6 The cnd_wait function (p: 380)

      [edit]See also

      blocks on a condition variable, with a timeout
      (function)[edit]
      C++ documentation forcondition_variable::wait
      C++ documentation forcondition_variable_any::wait
      Retrieved from "https://en.cppreference.com/mwiki/index.php?title=c/thread/cnd_wait&oldid=138848"

      [8]ページ先頭

      ©2009-2025 Movatter.jp