mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-16 06:05:58 -06:00
32 lines
442 B
C++
32 lines
442 B
C++
#include <Core/Core.h>
|
|
|
|
using namespace Upp;
|
|
|
|
CONSOLE_APP_MAIN
|
|
{
|
|
Mutex m;
|
|
static StaticMutex n;
|
|
for(int i = 0; i < 10000000; i++) {
|
|
{
|
|
RTIMING("Mutex::Enter");
|
|
m.Enter();
|
|
m.Leave();
|
|
}
|
|
{
|
|
RTIMING("Mutex::TryEnter");
|
|
if(m.TryEnter())
|
|
m.Leave();
|
|
}
|
|
{
|
|
RTIMING("StaticMutex::Enter");
|
|
__BREAK__;
|
|
n.Enter();
|
|
n.Leave();
|
|
}
|
|
{
|
|
RTIMING("StaticMutex::TryEnter");
|
|
if(n.TryEnter())
|
|
n.Leave();
|
|
}
|
|
}
|
|
}
|