共用方式為


mutex Class (STL)

Represents a mutex type. Objects of this type can be used to enforce mutual exclusion within a program.

class mutex;

Members

Public Constructors

Name

Description

mutex::mutex Constructor (STL)

Constructs a mutex object.

mutex::~mutex Destructor (STL)

Releases any resources that were used by the mutex object.

Public Methods

Name

Description

mutex::lock Method (STL)

Blocks the calling thread until the thread obtains ownership of the mutex.

mutex::native_handle Method (STL)

Returns the implementation-specific type that represents the mutex handle.

mutex::try_lock Method (STL)

Attempts to obtain ownership of the mutex without blocking.

mutex::unlock Method (STL)

Releases ownership of the mutex.

Requirements

Header: mutex

Namespace: std

See Also

Reference

<mutex>

Other Resources

C++ Standard Library Header Files