ultimatepp/uppdev/mt/mt.cpp
cxl 4a1c627474 Adding uppdev....
git-svn-id: svn://ultimatepp.org/upp/trunk@328 f0d560ea-af0d-0410-9eb7-867de7ffcac7
2008-08-15 08:36:24 +00:00

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();
}
}
}