Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

      C++ named requirements:SharedLockable(since C++14)

      From cppreference.com
      <cpp‎ |named req
       
       
      C++ named requirements
       

      TheSharedLockable requirements describe the minimal characteristics of types that provide shared blocking semantics for execution agents (i.e. threads).

      Contents

      [edit]Requirements

      For typeL to beSharedLockable, the following conditions have to be satisfied for an objectm of typeL:

      ExpressionPreconditionsEffectsReturn value
      m.lock_shared()Blocks until a lock can be obtained for the current execution agent (thread, process, task). If an exception is thrown, no lock is obtained.
      m.try_lock_shared()Attempts to obtain a lock for the current execution agent (thread, process, task) without blocking. If an exception is thrown, no lock is obtained.true if the lock was obtained,false otherwise
      m.unlock_shared()The current execution agent holds a shared lock onm.Releases the shared lock held by the execution agent.

      Throws no exceptions.

      [edit]Shared locks

      A lock on an object is said to beshared lock if it is acquired by a call tolock_shared,try_lock_shared,try_lock_shared_for, ortry_lock_shared_until member function.

      [edit]Standard library

      The following standard library types satisfySharedLockable requirements:

      provides shared mutual exclusion facility
      (class)[edit]
      provides shared mutual exclusion facility and implements locking with a timeout
      (class)[edit]

      [edit]See also

      Retrieved from "https://en.cppreference.com/mwiki/index.php?title=cpp/named_req/SharedLockable&oldid=177786"

      [8]ページ先頭

      ©2009-2025 Movatter.jp