共用方式為


critical_section::try_lock_for Method

Tries to acquire the lock without blocking for a specific number of milliseconds.

bool try_lock_for(
   unsigned int _Timeout
);

Parameters

  • _Timeout
    The number of milliseconds to wait before timing out.

Return Value

If the lock was acquired, the value true; otherwise, the value false.

Requirements

Header: concrt.h

Namespace: concurrency

See Also

Reference

critical_section Class

critical_section::unlock Method