.autotest: SpinLock

git-svn-id: svn://ultimatepp.org/upp/trunk@8111 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2015-01-31 13:40:12 +00:00
parent 00d54c7795
commit a595a7957c
3 changed files with 39 additions and 0 deletions

View file

@ -0,0 +1,26 @@
#include <Core/Core.h>
using namespace Upp;
SpinLock data_lock;
dword data;
void AddData()
{
data_lock.Enter();
data = data + 1;
data_lock.Leave();
}
CONSOLE_APP_MAIN
{
RTIMING("Test");
{
CoWork co;
for(int i = 0; i < 10000000; i++)
co & callback(AddData);
}
RDUMP(data);
ASSERT(data == 10000000);
LOG("================ OK");
}

View file

@ -0,0 +1,9 @@
uses
Core;
file
SpinLock.cpp;
mainconfig
"" = "SSE2 MT";

4
autotest/SpinLock/init Normal file
View file

@ -0,0 +1,4 @@
#ifndef _SpinLock_icpp_init_stub
#define _SpinLock_icpp_init_stub
#include "Core/init"
#endif