In C++11, mutex is attached as a standard library.
Of course, it can also be used in C++Builder.
There are mutex,recursive_mutex,timed_mutex,recursive_timed_mutex.
I tried timed_mutex this time.
timed_mutex supports lock acquisition timeout function.
Timeout uses chrono.
This is processing to wait 3 seconds for timeout.
Then, three seconds sleep processing.
So If the lock succeeds, it is push_back() to the vector.
Use call this class in the form button of FireMonkey C++ project.
Thread processing that timed out here is an exception.
So, it is not push_back() to vector.
Ten threads were created,There is both processing and exception handling is push_back() to vector.
The lock on timed_mutex timed out, so we handled the exception.