added NullMutex, extended Events so that mutex is a template param, minor performance optimzation for strategies

This commit is contained in:
Peter Schojer
2008-09-30 06:26:47 +00:00
parent ce17ae2c66
commit 358797c89e
11 changed files with 104 additions and 19 deletions

View File

@@ -62,11 +62,14 @@ void BasicEventTest::testNoDelegate()
EventArgs args;
assert (_count == 0);
assert (Simple.empty());
Simple.notify(this, tmp);
assert (_count == 0);
Simple += delegate(this, &BasicEventTest::onSimple);
assert (!Simple.empty());
Simple -= delegate(this, &BasicEventTest::onSimple);
assert (Simple.empty());
Simple.notify(this, tmp);
assert (_count == 0);
@@ -166,6 +169,24 @@ void BasicEventTest::testDuplicateRegister()
assert (_count == 1);
}
void BasicEventTest::testNullMutex()
{
Poco::BasicEvent<int, NullMutex> ev;
int tmp = 0;
assert (_count == 0);
ev += delegate(this, &BasicEventTest::onSimple);
ev += delegate(this, &BasicEventTest::onSimple);
ev.notify(this, tmp);
assert (_count == 1);
ev -= delegate(this, &BasicEventTest::onSimple);
ev.notify(this, tmp);
assert (_count == 1);
}
void BasicEventTest::testDuplicateUnregister()
{
// duplicate unregister shouldn't give an error,
@@ -406,5 +427,6 @@ CppUnit::Test* BasicEventTest::suite()
CppUnit_addTest(pSuite, BasicEventTest, testExpireReRegister);
CppUnit_addTest(pSuite, BasicEventTest, testOverwriteDelegate);
CppUnit_addTest(pSuite, BasicEventTest, testAsyncNotify);
CppUnit_addTest(pSuite, BasicEventTest, testNullMutex);
return pSuite;
}

View File

@@ -64,6 +64,7 @@ public:
void testReturnParams();
void testOverwriteDelegate();
void testAsyncNotify();
void testNullMutex();
void setUp();
void tearDown();