|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r56908 - in sandbox/stm/branches/vbe: boost boost/stm boost/stm/detail libs/stm/test
From: vicente.botet_at_[hidden]
Date: 2009-10-16 05:51:07
Author: viboes
Date: 2009-10-16 05:51:04 EDT (Fri, 16 Oct 2009)
New Revision: 56908
URL: http://svn.boost.org/trac/boost/changeset/56908
Log:
TBoost.STM vbe:
* Warning cleanup
* Trailing white spaces removal
Text files modified:
sandbox/stm/branches/vbe/boost/stm.hpp | 2
sandbox/stm/branches/vbe/boost/stm/detail/config.hpp | 4 +-
sandbox/stm/branches/vbe/boost/stm/synchro.hpp | 4 +-
sandbox/stm/branches/vbe/boost/stm/transaction.hpp | 1
sandbox/stm/branches/vbe/libs/stm/test/Jamfile.v2 | 2
sandbox/stm/branches/vbe/libs/stm/test/globalIntArr.cpp | 8 ++--
sandbox/stm/branches/vbe/libs/stm/test/irrevocableInt.cpp | 22 ++++++------
sandbox/stm/branches/vbe/libs/stm/test/isolatedComposedIntLockInTx.cpp | 22 ++++++------
sandbox/stm/branches/vbe/libs/stm/test/isolatedComposedIntLockInTx2.cpp | 26 +++++++-------
sandbox/stm/branches/vbe/libs/stm/test/isolatedInt.cpp | 22 ++++++------
sandbox/stm/branches/vbe/libs/stm/test/isolatedIntLockInTx.cpp | 24 +++++++-------
sandbox/stm/branches/vbe/libs/stm/test/litExample.cpp | 66 +++++++++++++++++++-------------------
sandbox/stm/branches/vbe/libs/stm/test/lotExample.cpp | 68 ++++++++++++++++++++--------------------
sandbox/stm/branches/vbe/libs/stm/test/nestedTxs.cpp | 20 +++++-----
sandbox/stm/branches/vbe/libs/stm/test/pointer_test.cpp | 22 ++++++------
sandbox/stm/branches/vbe/libs/stm/test/smart.cpp | 20 +++++-----
sandbox/stm/branches/vbe/libs/stm/test/testHT_latm.cpp | 32 +++++++++---------
sandbox/stm/branches/vbe/libs/stm/test/testHashMap.cpp | 24 +++++++-------
sandbox/stm/branches/vbe/libs/stm/test/testHashMapAndLinkedListsWithLocks.cpp | 40 +++++++++++-----------
sandbox/stm/branches/vbe/libs/stm/test/testHashMapWithLocks.cpp | 28 ++++++++--------
sandbox/stm/branches/vbe/libs/stm/test/testInt.cpp | 12 +++---
sandbox/stm/branches/vbe/libs/stm/test/testLL_latm.cpp | 32 +++++++++---------
sandbox/stm/branches/vbe/libs/stm/test/testLinkedList.cpp | 34 ++++++++++----------
sandbox/stm/branches/vbe/libs/stm/test/testLinkedList.h | 42 ++++++++++++------------
sandbox/stm/branches/vbe/libs/stm/test/testLinkedListBig.h | 42 ++++++++++++------------
sandbox/stm/branches/vbe/libs/stm/test/testLinkedListWithLocks.cpp | 28 ++++++++--------
sandbox/stm/branches/vbe/libs/stm/test/testLinkedListWithLocks.h | 46 +++++++++++++-------------
sandbox/stm/branches/vbe/libs/stm/test/testRBTree.cpp | 24 +++++++-------
sandbox/stm/branches/vbe/libs/stm/test/testRBTree.h | 26 ++++++--------
sandbox/stm/branches/vbe/libs/stm/test/testatom.cpp | 8 ++--
sandbox/stm/branches/vbe/libs/stm/test/transferFun.cpp | 24 +++++++-------
sandbox/stm/branches/vbe/libs/stm/test/txLinearLock.cpp | 6 +-
sandbox/stm/branches/vbe/libs/stm/test/usingLockTx.cpp | 18 +++++-----
sandbox/stm/branches/vbe/libs/stm/test/usingLockTx.h | 46 +++++++++++++-------------
34 files changed, 420 insertions(+), 425 deletions(-)
Modified: sandbox/stm/branches/vbe/boost/stm.hpp
==============================================================================
--- sandbox/stm/branches/vbe/boost/stm.hpp (original)
+++ sandbox/stm/branches/vbe/boost/stm.hpp 2009-10-16 05:51:04 EDT (Fri, 16 Oct 2009)
@@ -7,7 +7,7 @@
// (See accompanying file LICENSE_1_0.txt or
// copy at http://www.boost.org/LICENSE_1_0.txt)
//
-// See http://www.boost.org/libs/synchro for documentation.
+// See http://www.boost.org/libs/stm for documentation.
//
//////////////////////////////////////////////////////////////////////////////
Modified: sandbox/stm/branches/vbe/boost/stm/detail/config.hpp
==============================================================================
--- sandbox/stm/branches/vbe/boost/stm/detail/config.hpp (original)
+++ sandbox/stm/branches/vbe/boost/stm/detail/config.hpp 2009-10-16 05:51:04 EDT (Fri, 16 Oct 2009)
@@ -87,11 +87,11 @@
#define BOOST_STM_NO_PARTIAL_SPECIALIZATION 1
///////////////////////////////////////////////////////////////////////////////
-// Define BOOST_STM_ALLOWS_EMBEDEEDS when you want embeed TO
+// Define BOOST_STM_ALLOWS_EMBEDEEDS when you want embeed TO
#define BOOST_STM_ALLOWS_EMBEDEEDS 1
///////////////////////////////////////////////////////////////////////////////
-// Define BOOST_STM_ALLOWS_DELETERS when you want STM manage with others deleters than delete
+// Define BOOST_STM_ALLOWS_DELETERS when you want STM manage with others deleters than delete
#define BOOST_STM_ALLOWS_DELETERS 1
#endif // BOOST_STM_DETAIL_CONFIG_H
Modified: sandbox/stm/branches/vbe/boost/stm/synchro.hpp
==============================================================================
--- sandbox/stm/branches/vbe/boost/stm/synchro.hpp (original)
+++ sandbox/stm/branches/vbe/boost/stm/synchro.hpp 2009-10-16 05:51:04 EDT (Fri, 16 Oct 2009)
@@ -144,12 +144,12 @@
{
public:
- light_auto_lock(Mutex &mutex) : lock_(NULL)
+ light_auto_lock(Mutex &mutex) : lock_(0)
{
do_auto_lock(&mutex);
}
- light_auto_lock(Mutex *mutex) : lock_(NULL)
+ light_auto_lock(Mutex *mutex) : lock_(0)
{
do_auto_lock(mutex);
}
Modified: sandbox/stm/branches/vbe/boost/stm/transaction.hpp
==============================================================================
--- sandbox/stm/branches/vbe/boost/stm/transaction.hpp (original)
+++ sandbox/stm/branches/vbe/boost/stm/transaction.hpp 2009-10-16 05:51:04 EDT (Fri, 16 Oct 2009)
@@ -55,7 +55,6 @@
#endif
#endif
-
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
namespace boost { namespace stm {
Modified: sandbox/stm/branches/vbe/libs/stm/test/Jamfile.v2
==============================================================================
--- sandbox/stm/branches/vbe/libs/stm/test/Jamfile.v2 (original)
+++ sandbox/stm/branches/vbe/libs/stm/test/Jamfile.v2 2009-10-16 05:51:04 EDT (Fri, 16 Oct 2009)
@@ -22,7 +22,7 @@
<include>.
<include>../../..
- <include>/boost_1_39_0
+ <include>$BOOST_ROOT
<threading>multi
# <target-os>cygwin
# <interthreadapi>pthread
Modified: sandbox/stm/branches/vbe/libs/stm/test/globalIntArr.cpp
==============================================================================
--- sandbox/stm/branches/vbe/libs/stm/test/globalIntArr.cpp (original)
+++ sandbox/stm/branches/vbe/libs/stm/test/globalIntArr.cpp 2009-10-16 05:51:04 EDT (Fri, 16 Oct 2009)
@@ -205,14 +205,14 @@
threadsStarted.value() = 0;
endTimer = 0;
- pthread_create(&threads[0], NULL, SetGlobalInt, (void *)&threadId[0]);
- pthread_create(&threads[1], NULL, SetGlobalIntThread3, (void *)&threadId[1]);
+ pthread_create(&threads[0], 0, SetGlobalInt, (void *)&threadId[0]);
+ pthread_create(&threads[1], 0, SetGlobalIntThread3, (void *)&threadId[1]);
int mainThreadId = kLocalThreads-1;
- startTimer = time(NULL);
+ startTimer = time(0);
SumGlobalArray((void*)&mainThreadId);
- endTimer = time(NULL);
+ endTimer = time(0);
int averageRunTime = endTimer - startTimer;
if (averageRunTime < 1) averageRunTime = 1;
Modified: sandbox/stm/branches/vbe/libs/stm/test/irrevocableInt.cpp
==============================================================================
--- sandbox/stm/branches/vbe/libs/stm/test/irrevocableInt.cpp (original)
+++ sandbox/stm/branches/vbe/libs/stm/test/irrevocableInt.cpp 2009-10-16 05:51:04 EDT (Fri, 16 Oct 2009)
@@ -1,17 +1,17 @@
//////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Justin E. Gottchlich 2009.
-// (C) Copyright Vicente J. Botet Escriba 2009.
+// (C) Copyright Justin E. Gottchlich 2009.
+// (C) Copyright Vicente J. Botet Escriba 2009.
// Distributed under the Boost
-// Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or
+// Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or
// copy at http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org/libs/synchro for documentation.
//
//////////////////////////////////////////////////////////////////////////////
-/* The DRACO Research Group (rogue.colorado.edu/draco) */
+/* The DRACO Research Group (rogue.colorado.edu/draco) */
/*****************************************************************************\
*
* Copyright Notices/Identification of Licensor(s) of
@@ -65,7 +65,7 @@
cout << gInt.value() << endl;
break;
}
- catch (aborted_tx&)
+ catch (aborted_tx&)
{
cout << "Irrevocable transaction aborted" << endl;
}
@@ -75,7 +75,7 @@
//--------------------------------------------------------------------------
// last thread out sets the endTimer
//--------------------------------------------------------------------------
- endTimer = time(NULL);
+ endTimer = time(0);
finishThread(start);
if (*(int*)threadId != kMainThreadId)
@@ -104,7 +104,7 @@
{
t.w(gInt2).value()++;
- if (1)//0 == rand() % 2)
+ if (1)//0 == rand() % 2)
{
t.w(gInt).value()++;
}
@@ -118,7 +118,7 @@
//--------------------------------------------------------------------------
// last thread out sets the endTimer
//--------------------------------------------------------------------------
- endTimer = time(NULL);
+ endTimer = time(0);
finishThread(start);
if (*(int*)threadId != kMainThreadId)
@@ -140,7 +140,7 @@
//--------------------------------------------------------------------------
// Reset barrier variables before creating any threads. Otherwise, it is
- // possible for the first thread
+ // possible for the first thread
//--------------------------------------------------------------------------
threadsFinished.value() = 0;
threadsStarted.value() = 0;
@@ -150,7 +150,7 @@
for (int j = 0; j < kMaxThreads - 1; ++j)
{
threadId[j] = j;
- pthread_create(&threads[j], NULL, TestCount, (void *)&threadId[j]);
+ pthread_create(&threads[j], 0, TestCount, (void *)&threadId[j]);
}
int mainThreadId = kMaxThreads-1;
Modified: sandbox/stm/branches/vbe/libs/stm/test/isolatedComposedIntLockInTx.cpp
==============================================================================
--- sandbox/stm/branches/vbe/libs/stm/test/isolatedComposedIntLockInTx.cpp (original)
+++ sandbox/stm/branches/vbe/libs/stm/test/isolatedComposedIntLockInTx.cpp 2009-10-16 05:51:04 EDT (Fri, 16 Oct 2009)
@@ -1,17 +1,17 @@
//////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Justin E. Gottchlich 2009.
-// (C) Copyright Vicente J. Botet Escriba 2009.
+// (C) Copyright Justin E. Gottchlich 2009.
+// (C) Copyright Vicente J. Botet Escriba 2009.
// Distributed under the Boost
-// Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or
+// Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or
// copy at http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org/libs/synchro for documentation.
//
//////////////////////////////////////////////////////////////////////////////
-/* The DRACO Research Group (rogue.colorado.edu/draco) */
+/* The DRACO Research Group (rogue.colorado.edu/draco) */
/*****************************************************************************\
*
* Copyright Notices/Identification of Licensor(s) of
@@ -66,8 +66,8 @@
cout << "\t" << gInt.value() << endl;
transaction::unlock_(lock1);
- SLEEP(1000);
- // do nothing on purpose, allowing other threads time to see
+ SLEEP(1000);
+ // do nothing on purpose, allowing other threads time to see
// intermediate state IF they can get lock1 (they shouldn't)
transaction::lock_(lock1);
@@ -87,7 +87,7 @@
//--------------------------------------------------------------------------
// last thread out sets the endTimer
//--------------------------------------------------------------------------
- endTimer = time(NULL);
+ endTimer = time(0);
finishThread(start);
if (*(int*)threadId != kMainThreadId)
@@ -119,7 +119,7 @@
//--------------------------------------------------------------------------
// last thread out sets the endTimer
//--------------------------------------------------------------------------
- endTimer = time(NULL);
+ endTimer = time(0);
finishThread(start);
if (*(int*)threadId != kMainThreadId)
@@ -142,7 +142,7 @@
//--------------------------------------------------------------------------
// Reset barrier variables before creating any threads. Otherwise, it is
- // possible for the first thread
+ // possible for the first thread
//--------------------------------------------------------------------------
threadsFinished.value() = 0;
threadsStarted.value() = 0;
@@ -152,7 +152,7 @@
for (int j = 0; j < kMaxThreads - 1; ++j)
{
threadId[j] = j;
- pthread_create(&threads[j], NULL, TestIsolatedComposedLockInTxCount, (void *)&threadId[j]);
+ pthread_create(&threads[j], 0, TestIsolatedComposedLockInTxCount, (void *)&threadId[j]);
}
int mainThreadId = kMaxThreads-1;
Modified: sandbox/stm/branches/vbe/libs/stm/test/isolatedComposedIntLockInTx2.cpp
==============================================================================
--- sandbox/stm/branches/vbe/libs/stm/test/isolatedComposedIntLockInTx2.cpp (original)
+++ sandbox/stm/branches/vbe/libs/stm/test/isolatedComposedIntLockInTx2.cpp 2009-10-16 05:51:04 EDT (Fri, 16 Oct 2009)
@@ -1,17 +1,17 @@
//////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Justin E. Gottchlich 2009.
-// (C) Copyright Vicente J. Botet Escriba 2009.
+// (C) Copyright Justin E. Gottchlich 2009.
+// (C) Copyright Vicente J. Botet Escriba 2009.
// Distributed under the Boost
-// Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or
+// Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or
// copy at http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org/libs/synchro for documentation.
//
//////////////////////////////////////////////////////////////////////////////
-/* The DRACO Research Group (rogue.colorado.edu/draco) */
+/* The DRACO Research Group (rogue.colorado.edu/draco) */
/*****************************************************************************\
*
* Copyright Notices/Identification of Licensor(s) of
@@ -68,8 +68,8 @@
cout << "\t" << gInt.value() << endl;
transaction::unlock_(lock1);
- SLEEP(50);
- // do nothing on purpose, allowing other threads time to see
+ SLEEP(50);
+ // do nothing on purpose, allowing other threads time to see
// intermediate state IF they can get lock1 (they shouldn't)
transaction::lock_(lock1);
@@ -89,7 +89,7 @@
//--------------------------------------------------------------------------
// last thread out sets the endTimer
//--------------------------------------------------------------------------
- endTimer = time(NULL);
+ endTimer = time(0);
finishThread(start);
if (*(int*)threadId != kMainThreadId)
@@ -112,7 +112,7 @@
for (int i = startingValue; i < 100*endingValue; ++i)
{
- try
+ try
{
transaction t;
t.add_tx_conflicting_lock(&lock1);
@@ -128,7 +128,7 @@
//--------------------------------------------------------------------------
// last thread out sets the endTimer
//--------------------------------------------------------------------------
- endTimer = time(NULL);
+ endTimer = time(0);
finishThread(start);
if (*(int*)threadId != kMainThreadId)
@@ -168,7 +168,7 @@
//--------------------------------------------------------------------------
// last thread out sets the endTimer
//--------------------------------------------------------------------------
- endTimer = time(NULL);
+ endTimer = time(0);
finishThread(start);
if (*(int*)threadId != kMainThreadId)
@@ -190,7 +190,7 @@
//--------------------------------------------------------------------------
// Reset barrier variables before creating any threads. Otherwise, it is
- // possible for the first thread
+ // possible for the first thread
//--------------------------------------------------------------------------
threadsFinished.value() = 0;
threadsStarted.value() = 0;
@@ -200,7 +200,7 @@
for (int j = 0; j < kMaxThreads - 1; ++j)
{
threadId[j] = j;
- pthread_create(&threads[j], NULL, Test1, (void *)&threadId[j]);
+ pthread_create(&threads[j], 0, Test1, (void *)&threadId[j]);
}
int mainThreadId = kMaxThreads-1;
Modified: sandbox/stm/branches/vbe/libs/stm/test/isolatedInt.cpp
==============================================================================
--- sandbox/stm/branches/vbe/libs/stm/test/isolatedInt.cpp (original)
+++ sandbox/stm/branches/vbe/libs/stm/test/isolatedInt.cpp 2009-10-16 05:51:04 EDT (Fri, 16 Oct 2009)
@@ -1,17 +1,17 @@
//////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Justin E. Gottchlich 2009.
-// (C) Copyright Vicente J. Botet Escriba 2009.
+// (C) Copyright Justin E. Gottchlich 2009.
+// (C) Copyright Vicente J. Botet Escriba 2009.
// Distributed under the Boost
-// Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or
+// Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or
// copy at http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org/libs/synchro for documentation.
//
//////////////////////////////////////////////////////////////////////////////
-/* The DRACO Research Group (rogue.colorado.edu/draco) */
+/* The DRACO Research Group (rogue.colorado.edu/draco) */
/*****************************************************************************\
*
* Copyright Notices/Identification of Licensor(s) of
@@ -63,7 +63,7 @@
oldVal = gInt2.value();
++gInt2.value();
-
+
if (oldVal + 1 != gInt2.value())
{
cout << "invariant changed" << endl;
@@ -79,7 +79,7 @@
//--------------------------------------------------------------------------
// last thread out sets the endTimer
//--------------------------------------------------------------------------
- endTimer = time(NULL);
+ endTimer = time(0);
finishThread(start);
if (*(int*)threadId != kMainThreadId)
@@ -108,7 +108,7 @@
{
t.w(gInt2).value()++;
- if (1)//0 == rand() % 2)
+ if (1)//0 == rand() % 2)
{
t.w(gInt).value()++;
}
@@ -122,7 +122,7 @@
//--------------------------------------------------------------------------
// last thread out sets the endTimer
//--------------------------------------------------------------------------
- endTimer = time(NULL);
+ endTimer = time(0);
finishThread(start);
if (*(int*)threadId != kMainThreadId)
@@ -144,7 +144,7 @@
//--------------------------------------------------------------------------
// Reset barrier variables before creating any threads. Otherwise, it is
- // possible for the first thread
+ // possible for the first thread
//--------------------------------------------------------------------------
threadsFinished.value() = 0;
threadsStarted.value() = 0;
@@ -154,7 +154,7 @@
for (int j = 0; j < kMaxThreads - 1; ++j)
{
threadId[j] = j;
- pthread_create(&threads[j], NULL, TestCount, (void *)&threadId[j]);
+ pthread_create(&threads[j], 0, TestCount, (void *)&threadId[j]);
}
int mainThreadId = kMaxThreads-1;
Modified: sandbox/stm/branches/vbe/libs/stm/test/isolatedIntLockInTx.cpp
==============================================================================
--- sandbox/stm/branches/vbe/libs/stm/test/isolatedIntLockInTx.cpp (original)
+++ sandbox/stm/branches/vbe/libs/stm/test/isolatedIntLockInTx.cpp 2009-10-16 05:51:04 EDT (Fri, 16 Oct 2009)
@@ -1,17 +1,17 @@
//////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Justin E. Gottchlich 2009.
-// (C) Copyright Vicente J. Botet Escriba 2009.
+// (C) Copyright Justin E. Gottchlich 2009.
+// (C) Copyright Vicente J. Botet Escriba 2009.
// Distributed under the Boost
-// Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or
+// Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or
// copy at http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org/libs/synchro for documentation.
//
//////////////////////////////////////////////////////////////////////////////
-/* The DRACO Research Group (rogue.colorado.edu/draco) */
+/* The DRACO Research Group (rogue.colorado.edu/draco) */
/*****************************************************************************\
*
* Copyright Notices/Identification of Licensor(s) of
@@ -85,7 +85,7 @@
transaction::unlock_(lock1);
//-------------------------------------------------------
- // now again access gInt via tx. tx should access the
+ // now again access gInt via tx. tx should access the
// changes previously made by the lock
//-------------------------------------------------------
--t.w(gInt).value();
@@ -105,7 +105,7 @@
//--------------------------------------------------------------------------
// last thread out sets the endTimer
//--------------------------------------------------------------------------
- endTimer = time(NULL);
+ endTimer = time(0);
finishThread(start);
if (*(int*)threadId != kMainThreadId)
@@ -134,14 +134,14 @@
{
t.w(gInt).value()++;
- if (1)//0 == rand() % 2)
+ if (1)//0 == rand() % 2)
{
t.w(gInt2).value()++;
}
t.end();
break;
}
- catch (aborted_tx&)
+ catch (aborted_tx&)
{
cout << "aborted" << endl;
}
@@ -151,7 +151,7 @@
//--------------------------------------------------------------------------
// last thread out sets the endTimer
//--------------------------------------------------------------------------
- endTimer = time(NULL);
+ endTimer = time(0);
finishThread(start);
if (*(int*)threadId != kMainThreadId)
@@ -175,7 +175,7 @@
//--------------------------------------------------------------------------
// Reset barrier variables before creating any threads. Otherwise, it is
- // possible for the first thread
+ // possible for the first thread
//--------------------------------------------------------------------------
threadsFinished.value() = 0;
threadsStarted.value() = 0;
@@ -185,7 +185,7 @@
for (int j = 0; j < kMaxThreads - 1; ++j)
{
threadId[j] = j;
- pthread_create(&threads[j], NULL, TestIsolatedLockInTxCount, (void *)&threadId[j]);
+ pthread_create(&threads[j], 0, TestIsolatedLockInTxCount, (void *)&threadId[j]);
}
int mainThreadId = kMaxThreads-1;
Modified: sandbox/stm/branches/vbe/libs/stm/test/litExample.cpp
==============================================================================
--- sandbox/stm/branches/vbe/libs/stm/test/litExample.cpp (original)
+++ sandbox/stm/branches/vbe/libs/stm/test/litExample.cpp 2009-10-16 05:51:04 EDT (Fri, 16 Oct 2009)
@@ -1,17 +1,17 @@
//////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Justin E. Gottchlich 2009.
-// (C) Copyright Vicente J. Botet Escriba 2009.
+// (C) Copyright Justin E. Gottchlich 2009.
+// (C) Copyright Vicente J. Botet Escriba 2009.
// Distributed under the Boost
-// Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or
+// Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or
// copy at http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org/libs/synchro for documentation.
//
//////////////////////////////////////////////////////////////////////////////
-/* The DRACO Research Group (rogue.colorado.edu/draco) */
+/* The DRACO Research Group (rogue.colorado.edu/draco) */
/*****************************************************************************\
*
* Copyright Notices/Identification of Licensor(s) of
@@ -91,7 +91,7 @@
}
-static void do_work1()
+static void do_work1()
{
if (work1) return;
work1 = true;
@@ -112,7 +112,7 @@
}
}
-static void do_work2()
+static void do_work2()
{
if (work2) return;
work2 = true;
@@ -133,7 +133,7 @@
}
}
-void do_work3()
+void do_work3()
{
if (work3) return;
work3 = true;
@@ -146,13 +146,13 @@
transaction::unlock_(L8);
}
-static void* tx1(void *threadId)
+static void* tx1(void *threadId)
{
transaction::initialize_thread();
int start = *(int*)threadId;
idleUntilAllThreadsHaveReached(*(int*)threadId);
- startTimer = time(NULL);
+ startTimer = time(0);
for (int iters = 0; iters < txFactor*10*iterations; ++iters)
{
@@ -169,7 +169,7 @@
if (!work1) { do_work1(); }
if (!work2) { do_work2(); }
- endTimer = time(NULL);
+ endTimer = time(0);
finishThread(start);
if (*(int*)threadId != kMainThreadId)
@@ -181,13 +181,13 @@
return threadId;
}
-static void* tx2(void *threadId)
+static void* tx2(void *threadId)
{
transaction::initialize_thread();
int start = *(int*)threadId;
idleUntilAllThreadsHaveReached(*(int*)threadId);
- startTimer = time(NULL);
+ startTimer = time(0);
for (int iters = 0; iters < txFactor*10*iterations; ++iters)
{
@@ -202,7 +202,7 @@
if (!work1) { do_work1(); }
if (!work2) { do_work2(); }
- endTimer = time(NULL);
+ endTimer = time(0);
finishThread(start);
if (*(int*)threadId != kMainThreadId)
@@ -214,20 +214,20 @@
return threadId;
}
-static void* tx3(void *threadId)
+static void* tx3(void *threadId)
{
transaction::initialize_thread();
int start = *(int*)threadId;
idleUntilAllThreadsHaveReached(*(int*)threadId);
- startTimer = time(NULL);
+ startTimer = time(0);
for (int iters = 0; iters < txFactor*10*iterations; ++iters)
{
for (transaction t;;t.restart())
try {
-
+
t.add_tx_conflicting_lock(L3);
inc3();
t.end(); break;
@@ -237,7 +237,7 @@
if (!work1) { do_work1(); }
if (!work2) { do_work2(); }
- endTimer = time(NULL);
+ endTimer = time(0);
finishThread(start);
if (*(int*)threadId != kMainThreadId)
@@ -249,18 +249,18 @@
return threadId;
}
-static void* lock1(void *threadId)
+static void* lock1(void *threadId)
{
transaction::initialize_thread();
idleUntilAllThreadsHaveReached(*(int*)threadId);
- startTimer = time(NULL);
+ startTimer = time(0);
for (int iters = 0; iters < lockFactor*1000*iterations; ++iters)
{
inc2();
}
- endTimer = time(NULL);
+ endTimer = time(0);
finishThread();
if (*(int*)threadId != kMainThreadId)
@@ -271,18 +271,18 @@
return threadId;
}
-static void* lock2(void *threadId)
+static void* lock2(void *threadId)
{
transaction::initialize_thread();
idleUntilAllThreadsHaveReached(*(int*)threadId);
- startTimer = time(NULL);
+ startTimer = time(0);
for (int iters = 0; iters < lockFactor*1000*iterations; ++iters)
{
inc3();
}
- endTimer = time(NULL);
+ endTimer = time(0);
finishThread();
if (*(int*)threadId != kMainThreadId)
@@ -293,18 +293,18 @@
return threadId;
}
-static void* lock3(void *threadId)
+static void* lock3(void *threadId)
{
transaction::initialize_thread();
idleUntilAllThreadsHaveReached(*(int*)threadId);
- startTimer = time(NULL);
+ startTimer = time(0);
for (int iters = 0; iters < lockFactor*2000*iterations; ++iters)
{
inc4();
}
- endTimer = time(NULL);
+ endTimer = time(0);
finishThread();
if (*(int*)threadId != kMainThreadId)
@@ -341,7 +341,7 @@
//--------------------------------------------------------------------------
// Reset barrier variables before creating any threads. Otherwise, it is
- // possible for the first thread
+ // possible for the first thread
//--------------------------------------------------------------------------
threadsFinished.value() = 0;
threadsStarted.value() = 0;
@@ -349,19 +349,19 @@
endTimer = 0;
threadId[0] = 0;
- pthread_create(&threads[0], NULL, tx1, (void *)&threadId[0]);
+ pthread_create(&threads[0], 0, tx1, (void *)&threadId[0]);
threadId[1] = 1;
- pthread_create(&threads[1], NULL, tx2, (void *)&threadId[1]);
+ pthread_create(&threads[1], 0, tx2, (void *)&threadId[1]);
threadId[2] = 2;
- pthread_create(&threads[2], NULL, tx3, (void *)&threadId[2]);
+ pthread_create(&threads[2], 0, tx3, (void *)&threadId[2]);
threadId[3] = 3;
- pthread_create(&threads[3], NULL, lock1, (void *)&threadId[3]);
+ pthread_create(&threads[3], 0, lock1, (void *)&threadId[3]);
threadId[4] = 4;
- pthread_create(&threads[4], NULL, lock2, (void *)&threadId[4]);
+ pthread_create(&threads[4], 0, lock2, (void *)&threadId[4]);
int mainThreadId = kMaxThreads-1;
lock3((void*)&mainThreadId);
Modified: sandbox/stm/branches/vbe/libs/stm/test/lotExample.cpp
==============================================================================
--- sandbox/stm/branches/vbe/libs/stm/test/lotExample.cpp (original)
+++ sandbox/stm/branches/vbe/libs/stm/test/lotExample.cpp 2009-10-16 05:51:04 EDT (Fri, 16 Oct 2009)
@@ -1,17 +1,17 @@
//////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Justin E. Gottchlich 2009.
-// (C) Copyright Vicente J. Botet Escriba 2009.
+// (C) Copyright Justin E. Gottchlich 2009.
+// (C) Copyright Vicente J. Botet Escriba 2009.
// Distributed under the Boost
-// Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or
+// Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or
// copy at http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org/libs/synchro for documentation.
//
//////////////////////////////////////////////////////////////////////////////
-/* The DRACO Research Group (rogue.colorado.edu/draco) */
+/* The DRACO Research Group (rogue.colorado.edu/draco) */
/*****************************************************************************\
*
* Copyright Notices/Identification of Licensor(s) of
@@ -63,7 +63,7 @@
////////////////////////////////////////////////////////////////////////////
static int iterations = 0;
-static void do_work1()
+static void do_work1()
{
if (work1) return;
work1 = true;
@@ -84,7 +84,7 @@
}
}
-static void do_work2()
+static void do_work2()
{
if (work2) return;
work2 = true;
@@ -105,7 +105,7 @@
}
}
-void do_work3bis()
+void do_work3bis()
{
if (work3) return;
work3 = true;
@@ -121,7 +121,7 @@
}
}
-void do_work4()
+void do_work4()
{
if (work4) return;
work4 = true;
@@ -137,13 +137,13 @@
}
}
-static void* tx1(void *threadId)
+static void* tx1(void *threadId)
{
transaction::initialize_thread();
int start = *(int*)threadId;
idleUntilAllThreadsHaveReached(*(int*)threadId);
- startTimer = time(NULL);
+ startTimer = time(0);
for (int iters = 0; iters < txFactor*iterations; ++iters)
{
@@ -160,7 +160,7 @@
if (!work1) { do_work1(); }
if (!work2) { do_work2(); }
- endTimer = time(NULL);
+ endTimer = time(0);
finishThread(start);
if (*(int*)threadId != kMainThreadId)
@@ -172,13 +172,13 @@
return threadId;
}
-static void* tx2(void *threadId)
+static void* tx2(void *threadId)
{
transaction::initialize_thread();
int start = *(int*)threadId;
idleUntilAllThreadsHaveReached(*(int*)threadId);
- startTimer = time(NULL);
+ startTimer = time(0);
for (int iters = 0; iters < txFactor*iterations; ++iters)
{
@@ -195,7 +195,7 @@
if (!work1) { do_work1(); }
if (!work2) { do_work2(); }
- endTimer = time(NULL);
+ endTimer = time(0);
finishThread(start);
if (*(int*)threadId != kMainThreadId)
@@ -207,20 +207,20 @@
return threadId;
}
-static void* tx3(void *threadId)
+static void* tx3(void *threadId)
{
transaction::initialize_thread();
int start = *(int*)threadId;
idleUntilAllThreadsHaveReached(*(int*)threadId);
- startTimer = time(NULL);
+ startTimer = time(0);
for (int iters = 0; iters < txFactor*iterations; ++iters)
{
for (transaction t;;t.restart())
try {
-
+
t.add_tx_conflicting_lock(L1);
t.add_tx_conflicting_lock(L2);
@@ -236,7 +236,7 @@
if (!work1) { do_work1(); }
if (!work2) { do_work2(); }
- endTimer = time(NULL);
+ endTimer = time(0);
finishThread(start);
if (*(int*)threadId != kMainThreadId)
@@ -248,11 +248,11 @@
return threadId;
}
-static void* lock1(void *threadId)
+static void* lock1(void *threadId)
{
transaction::initialize_thread();
idleUntilAllThreadsHaveReached(*(int*)threadId);
- startTimer = time(NULL);
+ startTimer = time(0);
for (int iters = 0; iters < lockFactor*3000*iterations; ++iters)
{
@@ -261,7 +261,7 @@
transaction::unlock_(L1);
}
- endTimer = time(NULL);
+ endTimer = time(0);
finishThread();
if (*(int*)threadId != kMainThreadId)
@@ -272,11 +272,11 @@
return threadId;
}
-static void* lock2(void *threadId)
+static void* lock2(void *threadId)
{
transaction::initialize_thread();
idleUntilAllThreadsHaveReached(*(int*)threadId);
- startTimer = time(NULL);
+ startTimer = time(0);
for (int iters = 0; iters < lockFactor*3000*iterations; ++iters)
{
@@ -285,7 +285,7 @@
transaction::unlock_(L2);
}
- endTimer = time(NULL);
+ endTimer = time(0);
finishThread();
if (*(int*)threadId != kMainThreadId)
@@ -296,11 +296,11 @@
return threadId;
}
-static void* lock3(void *threadId)
+static void* lock3(void *threadId)
{
transaction::initialize_thread();
idleUntilAllThreadsHaveReached(*(int*)threadId);
- startTimer = time(NULL);
+ startTimer = time(0);
for (int iters = 0; iters < 10000*iterations; ++iters)
{
@@ -309,7 +309,7 @@
transaction::unlock_(L3);
}
- endTimer = time(NULL);
+ endTimer = time(0);
finishThread();
if (*(int*)threadId != kMainThreadId)
@@ -346,7 +346,7 @@
//--------------------------------------------------------------------------
// Reset barrier variables before creating any threads. Otherwise, it is
- // possible for the first thread
+ // possible for the first thread
//--------------------------------------------------------------------------
threadsFinished.value() = 0;
threadsStarted.value() = 0;
@@ -354,19 +354,19 @@
endTimer = 0;
threadId[0] = 0;
- pthread_create(&threads[0], NULL, tx1, (void *)&threadId[0]);
+ pthread_create(&threads[0], 0, tx1, (void *)&threadId[0]);
threadId[1] = 1;
- pthread_create(&threads[1], NULL, tx2, (void *)&threadId[1]);
+ pthread_create(&threads[1], 0, tx2, (void *)&threadId[1]);
threadId[2] = 2;
- pthread_create(&threads[2], NULL, tx3, (void *)&threadId[2]);
+ pthread_create(&threads[2], 0, tx3, (void *)&threadId[2]);
threadId[3] = 3;
- pthread_create(&threads[3], NULL, lock1, (void *)&threadId[3]);
+ pthread_create(&threads[3], 0, lock1, (void *)&threadId[3]);
threadId[4] = 4;
- pthread_create(&threads[4], NULL, lock2, (void *)&threadId[4]);
+ pthread_create(&threads[4], 0, lock2, (void *)&threadId[4]);
int mainThreadId = kMaxThreads-1;
lock3((void*)&mainThreadId);
Modified: sandbox/stm/branches/vbe/libs/stm/test/nestedTxs.cpp
==============================================================================
--- sandbox/stm/branches/vbe/libs/stm/test/nestedTxs.cpp (original)
+++ sandbox/stm/branches/vbe/libs/stm/test/nestedTxs.cpp 2009-10-16 05:51:04 EDT (Fri, 16 Oct 2009)
@@ -1,17 +1,17 @@
//////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Justin E. Gottchlich 2009.
-// (C) Copyright Vicente J. Botet Escriba 2009.
+// (C) Copyright Justin E. Gottchlich 2009.
+// (C) Copyright Vicente J. Botet Escriba 2009.
// Distributed under the Boost
-// Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or
+// Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or
// copy at http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org/libs/synchro for documentation.
//
//////////////////////////////////////////////////////////////////////////////
-/* The DRACO Research Group (rogue.colorado.edu/draco) */
+/* The DRACO Research Group (rogue.colorado.edu/draco) */
/*****************************************************************************\
*
* Copyright Notices/Identification of Licensor(s) of
@@ -141,7 +141,7 @@
}
++t.w(x);
}
- before_retry
+ before_retry
{
cout << "caught at nested2\n";
}
@@ -155,7 +155,7 @@
++t.w(x);
nested2();
}
- before_retry
+ before_retry
{
cout << "caught at nested1\n";
}
@@ -168,8 +168,8 @@
{
++t.w(x);
nested1();
- }
- before_retry
+ }
+ before_retry
{
cout << "caught at nested0" << endl;
}
@@ -260,7 +260,7 @@
pthread_t *second_thread = new pthread_t;
- pthread_create(second_thread, NULL, stall, (void*)NULL);
+ pthread_create(second_thread, 0, stall, (void*)0);
TestTransactionInsideLock();
TestEarlyRelease();
Modified: sandbox/stm/branches/vbe/libs/stm/test/pointer_test.cpp
==============================================================================
--- sandbox/stm/branches/vbe/libs/stm/test/pointer_test.cpp (original)
+++ sandbox/stm/branches/vbe/libs/stm/test/pointer_test.cpp 2009-10-16 05:51:04 EDT (Fri, 16 Oct 2009)
@@ -1,17 +1,17 @@
//////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Justin E. Gottchlich 2009.
-// (C) Copyright Vicente J. Botet Escriba 2009.
+// (C) Copyright Justin E. Gottchlich 2009.
+// (C) Copyright Vicente J. Botet Escriba 2009.
// Distributed under the Boost
-// Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or
+// Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or
// copy at http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org/libs/synchro for documentation.
//
//////////////////////////////////////////////////////////////////////////////
-/* The DRACO Research Group (rogue.colorado.edu/draco) */
+/* The DRACO Research Group (rogue.colorado.edu/draco) */
/*****************************************************************************\
*
* Copyright Notices/Identification of Licensor(s) of
@@ -38,7 +38,7 @@
using namespace boost::stm;
using namespace std;
-native_trans<int> *intP = NULL;
+native_trans<int> *intP = 0;
static void pointer_test_alloc()
{
@@ -49,7 +49,7 @@
*intP = 1;
t.force_to_abort();
t.end();
- } before_retry { intP = NULL; }
+ } before_retry { intP = 0; }
SLEEP(10000);
}
@@ -62,7 +62,7 @@
{
atomic(t)
{
- if (NULL != t.read_ptr(intP)) val = *t.read_ptr(intP);
+ if (0 != t.read_ptr(intP)) val = *t.read_ptr(intP);
cout << val << endl;
} end_atom
@@ -73,7 +73,7 @@
{
boost::stm::transaction::initialize_thread();
do_pointer_access();
- return NULL;
+ return 0;
}
void pointer_test()
@@ -86,7 +86,7 @@
//--------------------------------------------------------------------------
// Reset barrier variables before creating any threads. Otherwise, it is
- // possible for the first thread
+ // possible for the first thread
//--------------------------------------------------------------------------
threadsFinished.value() = 0;
threadsStarted.value() = 0;
@@ -96,7 +96,7 @@
for (int j = 0; j < kMaxThreads - 1; ++j)
{
threadId[j] = j;
- pthread_create(&threads[j], NULL, pointer_access_test, (void *)&threadId[j]);
+ pthread_create(&threads[j], 0, pointer_access_test, (void *)&threadId[j]);
}
pointer_test_alloc();
Modified: sandbox/stm/branches/vbe/libs/stm/test/smart.cpp
==============================================================================
--- sandbox/stm/branches/vbe/libs/stm/test/smart.cpp (original)
+++ sandbox/stm/branches/vbe/libs/stm/test/smart.cpp 2009-10-16 05:51:04 EDT (Fri, 16 Oct 2009)
@@ -1,10 +1,10 @@
//////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Justin E. Gottchlich 2009.
-// (C) Copyright Vicente J. Botet Escriba 2009.
+// (C) Copyright Justin E. Gottchlich 2009.
+// (C) Copyright Vicente J. Botet Escriba 2009.
// Distributed under the Boost
-// Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or
+// Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or
// copy at http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org/libs/synchro for documentation.
@@ -160,27 +160,27 @@
cout << "outer loop #: " << kMaxOuterLoops << endl;
cout << "inner loop #: " << kMaxInnerLoops << endl << endl;
- startTimer = time(NULL);
+ startTimer = time(0);
test_no_private();
- endTimer = time(NULL);
+ endTimer = time(0);
cout << "no_privatization time: " << endTimer - startTimer << endl;
cout << " txInt: " << txInt << endl << endl;
txInt = 0;
- startTimer = time(NULL);
+ startTimer = time(0);
test_priv_write_ptr();
- endTimer = time(NULL);
+ endTimer = time(0);
cout << " privatization time w/ write_ptr: " << endTimer - startTimer << endl;
cout << " txInt: " << txInt << endl << endl;
txInt = 0;
- startTimer = time(NULL);
+ startTimer = time(0);
test_priv_read_ptr();
- endTimer = time(NULL);
+ endTimer = time(0);
cout << " privatization time w/ read_ptr: " << endTimer - startTimer << endl;
cout << " txInt: " << txInt << endl << endl;
Modified: sandbox/stm/branches/vbe/libs/stm/test/testHT_latm.cpp
==============================================================================
--- sandbox/stm/branches/vbe/libs/stm/test/testHT_latm.cpp (original)
+++ sandbox/stm/branches/vbe/libs/stm/test/testHT_latm.cpp 2009-10-16 05:51:04 EDT (Fri, 16 Oct 2009)
@@ -1,17 +1,17 @@
//////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Justin E. Gottchlich 2009.
-// (C) Copyright Vicente J. Botet Escriba 2009.
+// (C) Copyright Justin E. Gottchlich 2009.
+// (C) Copyright Vicente J. Botet Escriba 2009.
// Distributed under the Boost
-// Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or
+// Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or
// copy at http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org/libs/synchro for documentation.
//
//////////////////////////////////////////////////////////////////////////////
-/* The DRACO Research Group (rogue.colorado.edu/draco) */
+/* The DRACO Research Group (rogue.colorado.edu/draco) */
/*****************************************************************************\
*
* Copyright Notices/Identification of Licensor(s) of
@@ -38,7 +38,7 @@
static int const kMaxThreadsWhenTestingSets = 128;
// Subtract one max linked list per complete set of four threads
static int const kMaxLinkedLists = kMaxThreadsWhenTestingSets - ((kMaxThreadsWhenTestingSets + 1) / 4);
-static LATM::LATM_HashMap< list_node_type > *llist[kMaxLinkedLists] = { NULL };
+static LATM::LATM_HashMap< list_node_type > *llist[kMaxLinkedLists] = { 0 };
static bool usingSingleList = false;
////////////////////////////////////////////////////////////////////////////
@@ -55,7 +55,7 @@
// lock -> list B
// trans + lock -> list C
//
- // Thus, for every set of four incremental thread ids, the linked list index
+ // Thus, for every set of four incremental thread ids, the linked list index
// increments only with the first three incremental thread ids.
//------------------------------------------------------------------------------
return id - ((id + 1) / 4);
@@ -82,7 +82,7 @@
idleUntilAllThreadsHaveReached(*(int*)threadId);
- if (kStartingTime == startTimer) startTimer = time(NULL);
+ if (kStartingTime == startTimer) startTimer = time(0);
//--------------------------------------------------------------------------
// do the transactional inserts. this is the main transactional loop.
@@ -136,7 +136,7 @@
//--------------------------------------------------------------------------
// last thread out sets the endTimer
//--------------------------------------------------------------------------
- endTimer = time(NULL);
+ endTimer = time(0);
finishThread(start);
if (*(int*)threadId != kMainThreadId)
@@ -168,7 +168,7 @@
idleUntilAllThreadsHaveReached(*(int*)threadId);
- if (kStartingTime == startTimer) startTimer = time(NULL);
+ if (kStartingTime == startTimer) startTimer = time(0);
//--------------------------------------------------------------------------
// do the transactional inserts. this is the main transactional loop.
@@ -221,7 +221,7 @@
//--------------------------------------------------------------------------
// last thread out sets the endTimer
//--------------------------------------------------------------------------
- endTimer = time(NULL);
+ endTimer = time(0);
finishThread(start);
if (*(int*)threadId != kMainThreadId)
@@ -259,7 +259,7 @@
for (int k = 0; k < kMaxThreads; ++k)
{
- llist[k] = new LATM::LATM_HashMap<list_node_type>;
+ llist[k] = new LATM::LATM_HashMap<list_node_type>;
transaction::initialize();
transaction::initialize_thread();
@@ -287,7 +287,7 @@
//--------------------------------------------------------------------------
// Reset barrier variables before creating any threads. Otherwise, it is
- // possible for the first thread
+ // possible for the first thread
//--------------------------------------------------------------------------
threadsFinished.value() = 0;
threadsStarted.value() = 0;
@@ -297,8 +297,8 @@
for (int j = 0; j < kMaxThreads - 1; ++j)
{
threadId[j] = j;
- if (0 == j % 2) pthread_create(&threads[j], NULL, TestLinkedListInserts, (void *)&threadId[j]);
- else pthread_create(&threads[j], NULL, TestLinkedListInsertsWithLocks, (void *)&threadId[j]);
+ if (0 == j % 2) pthread_create(&threads[j], 0, TestLinkedListInserts, (void *)&threadId[j]);
+ else pthread_create(&threads[j], 0, TestLinkedListInsertsWithLocks, (void *)&threadId[j]);
}
int mainThreadId = kMaxThreads-1;
@@ -338,7 +338,7 @@
cout << transaction::bookkeeping() << endl;
#if 0
- if ((kInsertSameValues && totalInserts != kMaxInserts) ||
+ if ((kInsertSameValues && totalInserts != kMaxInserts) ||
(!kInsertSameValues && totalInserts != kMaxInserts * kMaxThreads))
{
std::cout << std::endl << std::endl << "###########################################################";
Modified: sandbox/stm/branches/vbe/libs/stm/test/testHashMap.cpp
==============================================================================
--- sandbox/stm/branches/vbe/libs/stm/test/testHashMap.cpp (original)
+++ sandbox/stm/branches/vbe/libs/stm/test/testHashMap.cpp 2009-10-16 05:51:04 EDT (Fri, 16 Oct 2009)
@@ -1,17 +1,17 @@
//////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Justin E. Gottchlich 2009.
-// (C) Copyright Vicente J. Botet Escriba 2009.
+// (C) Copyright Justin E. Gottchlich 2009.
+// (C) Copyright Vicente J. Botet Escriba 2009.
// Distributed under the Boost
-// Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or
+// Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or
// copy at http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org/libs/synchro for documentation.
//
//////////////////////////////////////////////////////////////////////////////
-/* The DRACO Research Group (rogue.colorado.edu/draco) */
+/* The DRACO Research Group (rogue.colorado.edu/draco) */
/*****************************************************************************\
*
* Copyright Notices/Identification of Licensor(s) of
@@ -34,10 +34,10 @@
#include <fstream>
#include <sstream>
-HashMap<int> *hashMap = NULL;
+HashMap<int> *hashMap = 0;
////////////////////////////////////////////////////////////////////////////
-using namespace std; using namespace boost::stm; using namespace nHashMap;
+using namespace std; using namespace boost::stm; using namespace nHashMap;
using namespace nMain;
///////////////////////////////////////////////////////////////////////////////
@@ -56,7 +56,7 @@
idleUntilAllThreadsHaveReached(*(int*)threadId);
//cout << "i: " << startingValue << endl;
- if (kStartingTime == startTimer) startTimer = time(NULL);
+ if (kStartingTime == startTimer) startTimer = time(0);
//--------------------------------------------------------------------------
// do the transactional inserts. this is the main transactional loop.
@@ -94,7 +94,7 @@
//--------------------------------------------------------------------------
// last thread out sets the endTimer
//--------------------------------------------------------------------------
- endTimer = time(NULL);
+ endTimer = time(0);
finishThread(start);
if (*(int*)threadId != kMainThreadId)
@@ -124,7 +124,7 @@
//--------------------------------------------------------------------------
// Reset barrier variables before creating any threads. Otherwise, it is
- // possible for the first thread
+ // possible for the first thread
//--------------------------------------------------------------------------
threadsFinished.value() = 0;
threadsStarted.value() = 0;
@@ -134,7 +134,7 @@
for (int j = 0; j < kMaxThreads - 1; ++j)
{
threadId[j] = j;
- pthread_create(&threads[j], NULL, TestHashMapInserts, (void *)&threadId[j]);
+ pthread_create(&threads[j], 0, TestHashMapInserts, (void *)&threadId[j]);
}
int mainThreadId = kMaxThreads-1;
@@ -168,7 +168,7 @@
cout << " TX_SEC: " << transaction::bookkeeping().commits() / (totalAverageRunTime * runVector.size()) << endl;
cout << transaction::bookkeeping() << endl;
- if ((kInsertSameValues && totalInserts != kMaxInserts) ||
+ if ((kInsertSameValues && totalInserts != kMaxInserts) ||
(!kInsertSameValues && totalInserts != kMaxInserts * kMaxThreads))
{
std::cout << std::endl << std::endl << "###########################################################";
Modified: sandbox/stm/branches/vbe/libs/stm/test/testHashMapAndLinkedListsWithLocks.cpp
==============================================================================
--- sandbox/stm/branches/vbe/libs/stm/test/testHashMapAndLinkedListsWithLocks.cpp (original)
+++ sandbox/stm/branches/vbe/libs/stm/test/testHashMapAndLinkedListsWithLocks.cpp 2009-10-16 05:51:04 EDT (Fri, 16 Oct 2009)
@@ -1,17 +1,17 @@
//////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Justin E. Gottchlich 2009.
-// (C) Copyright Vicente J. Botet Escriba 2009.
+// (C) Copyright Justin E. Gottchlich 2009.
+// (C) Copyright Vicente J. Botet Escriba 2009.
// Distributed under the Boost
-// Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or
+// Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or
// copy at http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org/libs/synchro for documentation.
//
//////////////////////////////////////////////////////////////////////////////
-/* The DRACO Research Group (rogue.colorado.edu/draco) */
+/* The DRACO Research Group (rogue.colorado.edu/draco) */
/*****************************************************************************\
*
* Copyright Notices/Identification of Licensor(s) of
@@ -34,8 +34,8 @@
#include <fstream>
#include <sstream>
-static LATM::HashMap<int> *globalHashMap = NULL;
-static LATM::LinkedList<int> *globalLinkedList = NULL;
+static LATM::HashMap<int> *globalHashMap = 0;
+static LATM::LinkedList<int> *globalLinkedList = 0;
////////////////////////////////////////////////////////////////////////////
using namespace std; using namespace boost::stm; using namespace LATM::nHashMap;
@@ -93,7 +93,7 @@
idleUntilAllThreadsHaveReached(*(int*)threadId);
- if (kStartingTime == startTimer) startTimer = time(NULL);
+ if (kStartingTime == startTimer) startTimer = time(0);
//--------------------------------------------------------------------------
// do the transactional inserts. this is the main transactional loop.
@@ -143,7 +143,7 @@
//--------------------------------------------------------------------------
// last thread out sets the endTimer
//--------------------------------------------------------------------------
- endTimer = time(NULL);
+ endTimer = time(0);
finishThread(start);
if (*(int*)threadId != kMainThreadId)
@@ -170,7 +170,7 @@
idleUntilAllThreadsHaveReached(*(int*)threadId);
- if (kStartingTime == startTimer) startTimer = time(NULL);
+ if (kStartingTime == startTimer) startTimer = time(0);
//--------------------------------------------------------------------------
// do the transactional inserts. this is the main transactional loop.
@@ -223,7 +223,7 @@
//--------------------------------------------------------------------------
// last thread out sets the endTimer
//--------------------------------------------------------------------------
- endTimer = time(NULL);
+ endTimer = time(0);
finishThread(start);
if (*(int*)threadId != kMainThreadId)
@@ -251,7 +251,7 @@
idleUntilAllThreadsHaveReached(*(int*)threadId);
//cout << "i: " << startingValue << endl;
- if (kStartingTime == startTimer) startTimer = time(NULL);
+ if (kStartingTime == startTimer) startTimer = time(0);
//--------------------------------------------------------------------------
// do the transactional inserts. this is the main transactional loop.
@@ -289,7 +289,7 @@
//--------------------------------------------------------------------------
// last thread out sets the endTimer
//--------------------------------------------------------------------------
- endTimer = time(NULL);
+ endTimer = time(0);
finishThread(start);
if (*(int*)threadId != kMainThreadId)
@@ -317,7 +317,7 @@
idleUntilAllThreadsHaveReached(*(int*)threadId);
//cout << "i: " << startingValue << endl;
- if (kStartingTime == startTimer) startTimer = time(NULL);
+ if (kStartingTime == startTimer) startTimer = time(0);
//--------------------------------------------------------------------------
// do the transactional inserts. this is the main transactional loop.
@@ -355,7 +355,7 @@
//--------------------------------------------------------------------------
// last thread out sets the endTimer
//--------------------------------------------------------------------------
- endTimer = time(NULL);
+ endTimer = time(0);
finishThread(start);
if (*(int*)threadId != kMainThreadId)
@@ -384,7 +384,7 @@
cout << " TX_SEC: " << transaction::bookkeeping().commits() / runTime << endl;
cout << transaction::bookkeeping() << endl;
- if ((kInsertSameValues && totalInserts != kMaxInserts) ||
+ if ((kInsertSameValues && totalInserts != kMaxInserts) ||
(!kInsertSameValues && totalInserts != kMaxInserts * threadsDoingHashMap))
{
std::cout << std::endl << std::endl << "###########################################################";
@@ -405,7 +405,7 @@
cout << " TX_SEC: " << transaction::bookkeeping().commits() / runTime << endl;
cout << transaction::bookkeeping() << endl;
- if ((kInsertSameValues && totalInserts != kMaxInserts) ||
+ if ((kInsertSameValues && totalInserts != kMaxInserts) ||
(!kInsertSameValues && totalInserts != kMaxInserts * threadsDoingLinkedList))
{
std::cout << std::endl << std::endl << "###########################################################";
@@ -453,9 +453,9 @@
for (int j = 0; j < kMaxThreads - 1; ++j)
{
threadId[j] = j;
- if (0 == j % 2) pthread_create(&threads[j], NULL, TestHashMapInserts, (void *)&threadId[j]);
- else pthread_create(&threads[j], NULL, TestHashMapInsertsWithLocks, (void *)&threadId[j]);
- //pthread_create(&threads[j], NULL, TestLinkedListInserts, (void *)&threadId[j]);
+ if (0 == j % 2) pthread_create(&threads[j], 0, TestHashMapInserts, (void *)&threadId[j]);
+ else pthread_create(&threads[j], 0, TestHashMapInsertsWithLocks, (void *)&threadId[j]);
+ //pthread_create(&threads[j], 0, TestLinkedListInserts, (void *)&threadId[j]);
++hashingThreads;
}
Modified: sandbox/stm/branches/vbe/libs/stm/test/testHashMapWithLocks.cpp
==============================================================================
--- sandbox/stm/branches/vbe/libs/stm/test/testHashMapWithLocks.cpp (original)
+++ sandbox/stm/branches/vbe/libs/stm/test/testHashMapWithLocks.cpp 2009-10-16 05:51:04 EDT (Fri, 16 Oct 2009)
@@ -1,17 +1,17 @@
//////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Justin E. Gottchlich 2009.
-// (C) Copyright Vicente J. Botet Escriba 2009.
+// (C) Copyright Justin E. Gottchlich 2009.
+// (C) Copyright Vicente J. Botet Escriba 2009.
// Distributed under the Boost
-// Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or
+// Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or
// copy at http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org/libs/synchro for documentation.
//
//////////////////////////////////////////////////////////////////////////////
-/* The DRACO Research Group (rogue.colorado.edu/draco) */
+/* The DRACO Research Group (rogue.colorado.edu/draco) */
/*****************************************************************************\
*
* Copyright Notices/Identification of Licensor(s) of
@@ -34,10 +34,10 @@
#include <fstream>
#include <sstream>
-static LATM::HashMap<int> *globalHashMap = NULL;
+static LATM::HashMap<int> *globalHashMap = 0;
////////////////////////////////////////////////////////////////////////////
-using namespace std; using namespace boost::stm; using namespace LATM::nHashMap;
+using namespace std; using namespace boost::stm; using namespace LATM::nHashMap;
using namespace nMain;
///////////////////////////////////////////////////////////////////////////////
@@ -56,7 +56,7 @@
idleUntilAllThreadsHaveReached(*(int*)threadId);
//cout << "i: " << startingValue << endl;
- if (kStartingTime == startTimer) startTimer = time(NULL);
+ if (kStartingTime == startTimer) startTimer = time(0);
//--------------------------------------------------------------------------
// do the transactional inserts. this is the main transactional loop.
@@ -94,7 +94,7 @@
//--------------------------------------------------------------------------
// last thread out sets the endTimer
//--------------------------------------------------------------------------
- endTimer = time(NULL);
+ endTimer = time(0);
finishThread(start);
if (*(int*)threadId != kMainThreadId)
@@ -122,7 +122,7 @@
idleUntilAllThreadsHaveReached(*(int*)threadId);
//cout << "i: " << startingValue << endl;
- if (kStartingTime == startTimer) startTimer = time(NULL);
+ if (kStartingTime == startTimer) startTimer = time(0);
//--------------------------------------------------------------------------
// do the transactional inserts. this is the main transactional loop.
@@ -160,7 +160,7 @@
//--------------------------------------------------------------------------
// last thread out sets the endTimer
//--------------------------------------------------------------------------
- endTimer = time(NULL);
+ endTimer = time(0);
finishThread(start);
if (*(int*)threadId != kMainThreadId)
@@ -187,7 +187,7 @@
cout << " TX_SEC: " << transaction::bookkeeping().commits() / runTime << endl;
cout << transaction::bookkeeping() << endl;
- if ((kInsertSameValues && totalInserts != kMaxInserts) ||
+ if ((kInsertSameValues && totalInserts != kMaxInserts) ||
(!kInsertSameValues && totalInserts != kMaxInserts * kMaxThreads))
{
std::cout << std::endl << std::endl << "###########################################################";
@@ -234,8 +234,8 @@
for (int j = 0; j < kMaxThreads - 1; ++j)
{
threadId[j] = j;
- if (0 == j % 2) pthread_create(&threads[j], NULL, TestHashMapInserts, (void *)&threadId[j]);
- else pthread_create(&threads[j], NULL, TestHashMapInsertsWithLocks, (void *)&threadId[j]);
+ if (0 == j % 2) pthread_create(&threads[j], 0, TestHashMapInserts, (void *)&threadId[j]);
+ else pthread_create(&threads[j], 0, TestHashMapInsertsWithLocks, (void *)&threadId[j]);
}
int mainThreadId = kMaxThreads-1;
Modified: sandbox/stm/branches/vbe/libs/stm/test/testInt.cpp
==============================================================================
--- sandbox/stm/branches/vbe/libs/stm/test/testInt.cpp (original)
+++ sandbox/stm/branches/vbe/libs/stm/test/testInt.cpp 2009-10-16 05:51:04 EDT (Fri, 16 Oct 2009)
@@ -1,10 +1,10 @@
//////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Justin E. Gottchlich 2009.
-// (C) Copyright Vicente J. Botet Escriba 2009.
+// (C) Copyright Justin E. Gottchlich 2009.
+// (C) Copyright Vicente J. Botet Escriba 2009.
// Distributed under the Boost
-// Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or
+// Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or
// copy at http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org/libs/synchro for documentation.
@@ -14,7 +14,7 @@
#include "testInt.h"
#include <boost/stm/transaction.hpp>
-Integer *globalInt = NULL;
+Integer *globalInt = 0;
////////////////////////////////////////////////////////////////////////////
namespace nIntTest
@@ -79,7 +79,7 @@
for (int i = 0; i < kMaxThreads; ++i)
{
cout << "Creating thread: " << i << endl;
- rc = pthread_create(&threads[i], NULL, TestCount, (void *)&i);
+ rc = pthread_create(&threads[i], 0, TestCount, (void *)&i);
if (rc)
{
Modified: sandbox/stm/branches/vbe/libs/stm/test/testLL_latm.cpp
==============================================================================
--- sandbox/stm/branches/vbe/libs/stm/test/testLL_latm.cpp (original)
+++ sandbox/stm/branches/vbe/libs/stm/test/testLL_latm.cpp 2009-10-16 05:51:04 EDT (Fri, 16 Oct 2009)
@@ -1,17 +1,17 @@
//////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Justin E. Gottchlich 2009.
-// (C) Copyright Vicente J. Botet Escriba 2009.
+// (C) Copyright Justin E. Gottchlich 2009.
+// (C) Copyright Vicente J. Botet Escriba 2009.
// Distributed under the Boost
-// Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or
+// Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or
// copy at http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org/libs/synchro for documentation.
//
//////////////////////////////////////////////////////////////////////////////
-/* The DRACO Research Group (rogue.colorado.edu/draco) */
+/* The DRACO Research Group (rogue.colorado.edu/draco) */
/*****************************************************************************\
*
* Copyright Notices/Identification of Licensor(s) of
@@ -38,7 +38,7 @@
int const kMaxThreadsWhenTestingSets = 128;
// Subtract one max linked list per complete set of four threads
int const kMaxLinkedLists = kMaxThreadsWhenTestingSets - ((kMaxThreadsWhenTestingSets + 1) / 4);
-static LATM::LinkedList< list_node_type > *llist[kMaxLinkedLists] = { NULL };
+static LATM::LinkedList< list_node_type > *llist[kMaxLinkedLists] = { 0 };
bool usingSingleList = false;
////////////////////////////////////////////////////////////////////////////
@@ -55,7 +55,7 @@
// lock -> list B
// trans + lock -> list C
//
- // Thus, for every set of four incremental thread ids, the linked list index
+ // Thus, for every set of four incremental thread ids, the linked list index
// increments only with the first three incremental thread ids.
//------------------------------------------------------------------------------
return id - ((id + 1) / 4);
@@ -82,7 +82,7 @@
idleUntilAllThreadsHaveReached(*(int*)threadId);
- if (kStartingTime == startTimer) startTimer = time(NULL);
+ if (kStartingTime == startTimer) startTimer = time(0);
//--------------------------------------------------------------------------
// do the transactional inserts. this is the main transactional loop.
@@ -136,7 +136,7 @@
//--------------------------------------------------------------------------
// last thread out sets the endTimer
//--------------------------------------------------------------------------
- endTimer = time(NULL);
+ endTimer = time(0);
finishThread(start);
if (*(int*)threadId != kMainThreadId)
@@ -168,7 +168,7 @@
idleUntilAllThreadsHaveReached(*(int*)threadId);
- if (kStartingTime == startTimer) startTimer = time(NULL);
+ if (kStartingTime == startTimer) startTimer = time(0);
//--------------------------------------------------------------------------
// do the transactional inserts. this is the main transactional loop.
@@ -221,7 +221,7 @@
//--------------------------------------------------------------------------
// last thread out sets the endTimer
//--------------------------------------------------------------------------
- endTimer = time(NULL);
+ endTimer = time(0);
finishThread(start);
if (*(int*)threadId != kMainThreadId)
@@ -259,7 +259,7 @@
for (int k = 0; k < kMaxThreads; ++k)
{
- llist[k] = new LATM::LinkedList<list_node_type>;
+ llist[k] = new LATM::LinkedList<list_node_type>;
transaction::initialize();
transaction::initialize_thread();
@@ -287,7 +287,7 @@
//--------------------------------------------------------------------------
// Reset barrier variables before creating any threads. Otherwise, it is
- // possible for the first thread
+ // possible for the first thread
//--------------------------------------------------------------------------
threadsFinished.value() = 0;
threadsStarted.value() = 0;
@@ -297,8 +297,8 @@
for (int j = 0; j < kMaxThreads - 1; ++j)
{
threadId[j] = j;
- if (0 == j % 2) pthread_create(&threads[j], NULL, TestLinkedListInserts, (void *)&threadId[j]);
- else pthread_create(&threads[j], NULL, TestLinkedListInsertsWithLocks, (void *)&threadId[j]);
+ if (0 == j % 2) pthread_create(&threads[j], 0, TestLinkedListInserts, (void *)&threadId[j]);
+ else pthread_create(&threads[j], 0, TestLinkedListInsertsWithLocks, (void *)&threadId[j]);
}
int mainThreadId = kMaxThreads-1;
@@ -338,7 +338,7 @@
cout << transaction::bookkeeping() << endl;
#if 0
- if ((kInsertSameValues && totalInserts != kMaxInserts) ||
+ if ((kInsertSameValues && totalInserts != kMaxInserts) ||
(!kInsertSameValues && totalInserts != kMaxInserts * kMaxThreads))
{
std::cout << std::endl << std::endl << "###########################################################";
Modified: sandbox/stm/branches/vbe/libs/stm/test/testLinkedList.cpp
==============================================================================
--- sandbox/stm/branches/vbe/libs/stm/test/testLinkedList.cpp (original)
+++ sandbox/stm/branches/vbe/libs/stm/test/testLinkedList.cpp 2009-10-16 05:51:04 EDT (Fri, 16 Oct 2009)
@@ -1,10 +1,10 @@
//////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Justin E. Gottchlich 2009.
-// (C) Copyright Vicente J. Botet Escriba 2009.
+// (C) Copyright Justin E. Gottchlich 2009.
+// (C) Copyright Vicente J. Botet Escriba 2009.
// Distributed under the Boost
-// Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or
+// Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or
// copy at http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org/libs/synchro for documentation.
@@ -28,7 +28,7 @@
#endif
#endif
-/* The DRACO Research Group (rogue.colorado.edu/draco) */
+/* The DRACO Research Group (rogue.colorado.edu/draco) */
/*****************************************************************************\
*
* Copyright Notices/Identification of Licensor(s) of
@@ -52,7 +52,7 @@
typedef int list_node_type;
-LinkedList< list_node_type > *llist = NULL;
+LinkedList< list_node_type > *llist = 0;
////////////////////////////////////////////////////////////////////////////
using namespace std; using namespace boost::stm;
@@ -63,7 +63,7 @@
{
#ifdef BOOST_STM_LL_USES_NODE
//list_node<list_node_type> node;
-#endif
+#endif
transaction::initialize_thread();
int start = *(int*)threadId;
@@ -77,7 +77,7 @@
idleUntilAllThreadsHaveReached(*(int*)threadId);
//cout << "real started " << start <<endl;
- if (kStartingTime == startTimer) startTimer = time(NULL);
+ if (kStartingTime == startTimer) startTimer = time(0);
//--------------------------------------------------------------------------
// do the transactional inserts. this is the main transactional loop.
@@ -90,9 +90,9 @@
list_node<list_node_type> node(i);
//node.value() = i;
llist->insert(node);
-#else
+#else
llist->insert(i);
-#endif
+#endif
}
if (kDoMove)
@@ -104,7 +104,7 @@
node1.value() = j;
//node2.value() = -j;
llist->move(node1, node2);
-
+
}
}
@@ -133,14 +133,14 @@
llist->remove(node);
#else
llist->remove(i);
-#endif
+#endif
}
}
//--------------------------------------------------------------------------
// last thread out sets the endTimer
//--------------------------------------------------------------------------
- endTimer = time(NULL);
+ endTimer = time(0);
//finishThread(start);
//if (*(int*)threadId != kMainThreadId)
@@ -171,7 +171,7 @@
//--------------------------------------------------------------------------
// Reset barrier variables before creating any threads. Otherwise, it is
- // possible for the first thread
+ // possible for the first thread
//--------------------------------------------------------------------------
threadsFinished.value() = 0;
threadsStarted.value() = 0;
@@ -181,7 +181,7 @@
for (int j = 0; j < kMaxThreads ; ++j)
{
threadId[j] = j;
- pthread_create(&threads[j], NULL, TestLinkedListInserts, (void *)&threadId[j]);
+ pthread_create(&threads[j], 0, TestLinkedListInserts, (void *)&threadId[j]);
}
@@ -201,7 +201,7 @@
pthread_join(threads[j], 0);
}
#endif
-
+
int totalInserts = llist->walk_size();
int averageRunTime = endTimer - startTimer;
@@ -224,7 +224,7 @@
cout << " TX_SEC: " << transaction::bookkeeping().commits() / (totalAverageRunTime * runVector.size()) << endl;
cout << transaction::bookkeeping() << endl;
- if ((kInsertSameValues && totalInserts != kMaxInserts) ||
+ if ((kInsertSameValues && totalInserts != kMaxInserts) ||
(!kInsertSameValues && totalInserts != kMaxInserts * kMaxThreads))
{
std::cout << std::endl << std::endl << "###########################################################";
Modified: sandbox/stm/branches/vbe/libs/stm/test/testLinkedList.h
==============================================================================
--- sandbox/stm/branches/vbe/libs/stm/test/testLinkedList.h (original)
+++ sandbox/stm/branches/vbe/libs/stm/test/testLinkedList.h 2009-10-16 05:51:04 EDT (Fri, 16 Oct 2009)
@@ -34,12 +34,12 @@
list_node() : value_(0), next_(0) {
memset(big_, BIG_SIZE, 0);
}
- explicit list_node(T const &rhs) : value_(rhs), next_(NULL) {
+ explicit list_node(T const &rhs) : value_(rhs), next_(0) {
memset(big_, BIG_SIZE, 0);
}
// zero initialization for native types
- void clear() { value_ = T(); next_ = NULL; }
+ void clear() { value_ = T(); next_ = 0; }
T &value() { return value_; }
T const &value() const { return value_; }
@@ -48,13 +48,13 @@
void next(list_node const *rhs, boost::stm::transaction &t)
{
- if (NULL == rhs) next_ = NULL;
+ if (0 == rhs) next_ = 0;
else next_ = &t.find_original(*(list_node<T>*)rhs);
}
void next_for_new_mem(list_node const *rhs, boost::stm::transaction &t)
{
- if (NULL == rhs) next_ = NULL;
+ if (0 == rhs) next_ = 0;
else next_ = &t.find_original(*(list_node<T>*)rhs);
}
@@ -201,7 +201,7 @@
void outputList(std::ofstream &o)
{
int i = 0;
- for (list_node<T> const *cur = head_.next(); cur != NULL; cur = cur->next())
+ for (list_node<T> const *cur = head_.next(); cur != 0; cur = cur->next())
{
o << "element [" << i++ << "]: " << cur->value() << std::endl;
}
@@ -211,7 +211,7 @@
int walk_size()
{
int i = 0;
- for (list_node<T> const *cur = head_.next(); cur != NULL; cur = cur->next())
+ for (list_node<T> const *cur = head_.next(); cur != 0; cur = cur->next())
{
++i;
}
@@ -222,7 +222,7 @@
////////////////////////////////////////////////////////////////////////////
void quick_clear()
{
- for (list_node<T> const *cur = head_.next(); cur != NULL;)
+ for (list_node<T> const *cur = head_.next(); cur != 0;)
{
list_node<T> const *prev = cur;
cur = cur->next();
@@ -237,7 +237,7 @@
{
boost::stm::transaction t;
- for (list_node<T> const *cur = t.read(head_).next(); cur != NULL;)
+ for (list_node<T> const *cur = t.read(head_).next(); cur != 0;)
{
list_node<T> const *prev = &t.read(*cur);
cur = t.read(*cur).next();
@@ -258,7 +258,7 @@
{
list_node<T> const *headP = &t.read(head_);
- if (NULL != headP->next())
+ if (0 != headP->next())
{
list_node<T> const *prev = headP;
list_node<T> const *cur = t.read_ptr(headP->next());
@@ -273,7 +273,7 @@
list_node<T> const *curNext = t.read_ptr(cur->next());
- if (NULL == curNext) break;
+ if (0 == curNext) break;
cur = curNext;
}
@@ -313,7 +313,7 @@
//T val = valr;
list_node<T> const *headP = &t.read(head_);
- if (NULL != headP->next())
+ if (0 != headP->next())
{
list_node<T> const *prev = headP;
list_node<T> const *cur = t.read_ptr(headP->next());
@@ -327,7 +327,7 @@
list_node<T> const *curNext = t.read_ptr(cur->next());
- if (NULL == curNext) break;
+ if (0 == curNext) break;
cur = curNext;
}
@@ -387,7 +387,7 @@
return true;
}
- if (NULL == trueCur->next()) break;
+ if (0 == trueCur->next()) break;
}
return false;
@@ -398,11 +398,11 @@
{
list_node<T> const *prev = &t.read(head_);
- for (list_node<T> const *cur = prev; cur != NULL; prev = cur)
+ for (list_node<T> const *cur = prev; cur != 0; prev = cur)
{
cur = t.read(*cur).next();
- if (NULL == cur) break;
+ if (0 == cur) break;
if (cur->value() == rhs.value())
{
@@ -426,11 +426,11 @@
{
list_node<T> const *prev = &t.read(head_);
- for (list_node<T> const *cur = prev; cur != NULL; prev = cur)
+ for (list_node<T> const *cur = prev; cur != 0; prev = cur)
{
cur = t.read(*cur).next();
- if (NULL == cur) break;
+ if (0 == cur) break;
if (cur->value() == value)
{
@@ -455,7 +455,7 @@
list_node<T> const *headP = &t.read(head_);
- if (NULL != headP->next())
+ if (0 != headP->next())
{
list_node<T> const *prev = headP;
list_node<T> const *cur = t.read_ptr(headP->next());
@@ -470,7 +470,7 @@
list_node<T> const *curNext = t.read_ptr(cur->next());
- if (NULL == curNext) break;
+ if (0 == curNext) break;
cur = curNext;
}
@@ -481,7 +481,7 @@
// if cur->next() is null it means our newNode value is greater than
// cur, so insert ourselves after cur.
//--------------------------------------------------------------------
- if (NULL == cur->next()) t.write_ptr((list_node<T>*)cur)->next_for_new_mem(newNode, t);
+ if (0 == cur->next()) t.write_ptr((list_node<T>*)cur)->next_for_new_mem(newNode, t);
//--------------------------------------------------------------------
// otherwise, we are smaller than cur, so insert between prev and cur
//--------------------------------------------------------------------
@@ -509,7 +509,7 @@
list_node<T> const *prev = &t.read(head_);
- for (list_node<T> const *cur = prev; cur != NULL;
+ for (list_node<T> const *cur = prev; cur != 0;
prev = cur, cur = t.read(*cur).next())
{
if (cur->value() == rhs.value())
Modified: sandbox/stm/branches/vbe/libs/stm/test/testLinkedListBig.h
==============================================================================
--- sandbox/stm/branches/vbe/libs/stm/test/testLinkedListBig.h (original)
+++ sandbox/stm/branches/vbe/libs/stm/test/testLinkedListBig.h 2009-10-16 05:51:04 EDT (Fri, 16 Oct 2009)
@@ -28,11 +28,11 @@
list_node() : value_(0), next_(0) {
}
- explicit list_node(T const &rhs) : value_(rhs), next_(NULL) {
+ explicit list_node(T const &rhs) : value_(rhs), next_(0) {
}
// zero initialization for native types
- void clear() { value_ = T(); next_ = NULL; }
+ void clear() { value_ = T(); next_ = 0; }
T &value() { return value_; }
T const &value() const { return value_; }
@@ -41,13 +41,13 @@
void next(list_node const *rhs, boost::stm::transaction &t)
{
- if (NULL == rhs) next_ = NULL;
+ if (0 == rhs) next_ = 0;
else next_ = &t.find_original(*(list_node<T>*)rhs);
}
void next_for_new_mem(list_node const *rhs, boost::stm::transaction &t)
{
- if (NULL == rhs) next_ = NULL;
+ if (0 == rhs) next_ = 0;
else next_ = &t.find_original(*(list_node<T>*)rhs);
}
@@ -185,7 +185,7 @@
void outputList(std::ofstream &o)
{
int i = 0;
- for (list_node<T> const *cur = head_.next(); cur != NULL; cur = cur->next())
+ for (list_node<T> const *cur = head_.next(); cur != 0; cur = cur->next())
{
o << "element [" << i++ << "]: " << cur->value() << std::endl;
}
@@ -195,7 +195,7 @@
int walk_size()
{
int i = 0;
- for (list_node<T> const *cur = head_.next(); cur != NULL; cur = cur->next())
+ for (list_node<T> const *cur = head_.next(); cur != 0; cur = cur->next())
{
++i;
}
@@ -206,7 +206,7 @@
////////////////////////////////////////////////////////////////////////////
void quick_clear()
{
- for (list_node<T> const *cur = head_.next(); cur != NULL;)
+ for (list_node<T> const *cur = head_.next(); cur != 0;)
{
list_node<T> const *prev = cur;
cur = cur->next();
@@ -221,7 +221,7 @@
{
boost::stm::transaction t;
- for (list_node<T> const *cur = t.read(head_).next(); cur != NULL;)
+ for (list_node<T> const *cur = t.read(head_).next(); cur != 0;)
{
list_node<T> const *prev = &t.read(*cur);
cur = t.read(*cur).next();
@@ -242,7 +242,7 @@
{
list_node<T> const *headP = &t.read(head_);
- if (NULL != headP->next())
+ if (0 != headP->next())
{
list_node<T> const *prev = headP;
list_node<T> const *cur = t.read_ptr(headP->next());
@@ -257,7 +257,7 @@
list_node<T> const *curNext = t.read_ptr(cur->next());
- if (NULL == curNext) break;
+ if (0 == curNext) break;
cur = curNext;
}
@@ -297,7 +297,7 @@
//T val = valr;
list_node<T> const *headP = &t.read(head_);
- if (NULL != headP->next())
+ if (0 != headP->next())
{
list_node<T> const *prev = headP;
list_node<T> const *cur = t.read_ptr(headP->next());
@@ -311,7 +311,7 @@
list_node<T> const *curNext = t.read_ptr(cur->next());
- if (NULL == curNext) break;
+ if (0 == curNext) break;
cur = curNext;
}
@@ -372,7 +372,7 @@
return true;
}
- if (NULL == trueCur->next()) break;
+ if (0 == trueCur->next()) break;
}
return false;
@@ -383,11 +383,11 @@
{
list_node<T> const *prev = &t.read(head_);
- for (list_node<T> const *cur = prev; cur != NULL; prev = cur)
+ for (list_node<T> const *cur = prev; cur != 0; prev = cur)
{
cur = t.read(*cur).next();
- if (NULL == cur) break;
+ if (0 == cur) break;
if (cur->value() == rhs.value())
{
@@ -411,11 +411,11 @@
{
list_node<T> const *prev = &t.read(head_);
- for (list_node<T> const *cur = prev; cur != NULL; prev = cur)
+ for (list_node<T> const *cur = prev; cur != 0; prev = cur)
{
cur = t.read(*cur).next();
- if (NULL == cur) break;
+ if (0 == cur) break;
if (cur->value() == value)
{
@@ -440,7 +440,7 @@
list_node<T> const *headP = &t.read(head_);
- if (NULL != headP->next())
+ if (0 != headP->next())
{
list_node<T> const *prev = headP;
list_node<T> const *cur = t.read_ptr(headP->next());
@@ -455,7 +455,7 @@
list_node<T> const *curNext = t.read_ptr(cur->next());
- if (NULL == curNext) break;
+ if (0 == curNext) break;
cur = curNext;
}
@@ -466,7 +466,7 @@
// if cur->next() is null it means our newNode value is greater than
// cur, so insert ourselves after cur.
//--------------------------------------------------------------------
- if (NULL == cur->next()) t.write_ptr((list_node<T>*)cur)->next_for_new_mem(newNode, t);
+ if (0 == cur->next()) t.write_ptr((list_node<T>*)cur)->next_for_new_mem(newNode, t);
//--------------------------------------------------------------------
// otherwise, we are smaller than cur, so insert between prev and cur
//--------------------------------------------------------------------
@@ -494,7 +494,7 @@
list_node<T> const *prev = &t.read(head_);
- for (list_node<T> const *cur = prev; cur != NULL;
+ for (list_node<T> const *cur = prev; cur != 0;
prev = cur, cur = t.read(*cur).next())
{
if (cur->value() == rhs.value())
Modified: sandbox/stm/branches/vbe/libs/stm/test/testLinkedListWithLocks.cpp
==============================================================================
--- sandbox/stm/branches/vbe/libs/stm/test/testLinkedListWithLocks.cpp (original)
+++ sandbox/stm/branches/vbe/libs/stm/test/testLinkedListWithLocks.cpp 2009-10-16 05:51:04 EDT (Fri, 16 Oct 2009)
@@ -1,17 +1,17 @@
//////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Justin E. Gottchlich 2009.
-// (C) Copyright Vicente J. Botet Escriba 2009.
+// (C) Copyright Justin E. Gottchlich 2009.
+// (C) Copyright Vicente J. Botet Escriba 2009.
// Distributed under the Boost
-// Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or
+// Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or
// copy at http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org/libs/synchro for documentation.
//
//////////////////////////////////////////////////////////////////////////////
-/* The DRACO Research Group (rogue.colorado.edu/draco) */
+/* The DRACO Research Group (rogue.colorado.edu/draco) */
/*****************************************************************************\
*
* Copyright Notices/Identification of Licensor(s) of
@@ -35,7 +35,7 @@
typedef int list_node_type;
-static LATM::LinkedList< list_node_type > *llist = NULL;
+static LATM::LinkedList< list_node_type > *llist = 0;
////////////////////////////////////////////////////////////////////////////
using namespace std; using namespace boost::stm;
@@ -57,7 +57,7 @@
idleUntilAllThreadsHaveReached(*(int*)threadId);
- if (kStartingTime == startTimer) startTimer = time(NULL);
+ if (kStartingTime == startTimer) startTimer = time(0);
//--------------------------------------------------------------------------
// do the transactional inserts. this is the main transactional loop.
@@ -110,7 +110,7 @@
//--------------------------------------------------------------------------
// last thread out sets the endTimer
//--------------------------------------------------------------------------
- endTimer = time(NULL);
+ endTimer = time(0);
finishThread(start);
if (*(int*)threadId != kMainThreadId)
@@ -138,7 +138,7 @@
idleUntilAllThreadsHaveReached(*(int*)threadId);
- if (kStartingTime == startTimer) startTimer = time(NULL);
+ if (kStartingTime == startTimer) startTimer = time(0);
//--------------------------------------------------------------------------
// do the transactional inserts. this is the main transactional loop.
@@ -191,7 +191,7 @@
//--------------------------------------------------------------------------
// last thread out sets the endTimer
//--------------------------------------------------------------------------
- endTimer = time(NULL);
+ endTimer = time(0);
finishThread(start);
if (*(int*)threadId != kMainThreadId)
@@ -224,7 +224,7 @@
//--------------------------------------------------------------------------
// Reset barrier variables before creating any threads. Otherwise, it is
- // possible for the first thread
+ // possible for the first thread
//--------------------------------------------------------------------------
threadsFinished.value() = 0;
threadsStarted.value() = 0;
@@ -234,8 +234,8 @@
for (int j = 0; j < kMaxThreads - 1; ++j)
{
threadId[j] = j;
- if (0 == j % 2) pthread_create(&threads[j], NULL, TestLinkedListInserts, (void *)&threadId[j]);
- else pthread_create(&threads[j], NULL, TestLinkedListInsertsWithLocks, (void *)&threadId[j]);
+ if (0 == j % 2) pthread_create(&threads[j], 0, TestLinkedListInserts, (void *)&threadId[j]);
+ else pthread_create(&threads[j], 0, TestLinkedListInsertsWithLocks, (void *)&threadId[j]);
}
int mainThreadId = kMaxThreads-1;
@@ -270,7 +270,7 @@
cout << " TX_SEC: " << transaction::bookkeeping().commits() / (totalAverageRunTime * runVector.size()) << endl;
cout << transaction::bookkeeping() << endl;
- if ((kInsertSameValues && totalInserts != kMaxInserts) ||
+ if ((kInsertSameValues && totalInserts != kMaxInserts) ||
(!kInsertSameValues && totalInserts != kMaxInserts * kMaxThreads))
{
std::cout << std::endl << std::endl << "###########################################################";
Modified: sandbox/stm/branches/vbe/libs/stm/test/testLinkedListWithLocks.h
==============================================================================
--- sandbox/stm/branches/vbe/libs/stm/test/testLinkedListWithLocks.h (original)
+++ sandbox/stm/branches/vbe/libs/stm/test/testLinkedListWithLocks.h 2009-10-16 05:51:04 EDT (Fri, 16 Oct 2009)
@@ -34,10 +34,10 @@
public:
list_node() : next_(0), value_(0) {}
- explicit list_node(int const &rhs) : value_(rhs), next_(NULL) {}
+ explicit list_node(int const &rhs) : value_(rhs), next_(0) {}
// zero initialization for native types
- void clear() { value_ = T(); next_ = NULL; }
+ void clear() { value_ = T(); next_ = 0; }
T &value() { return value_; }
T const &value() const { return value_; }
@@ -49,13 +49,13 @@
void next(list_node const *rhs, boost::stm::transaction &t)
{
- if (NULL == rhs) next_ = NULL;
+ if (0 == rhs) next_ = 0;
else next_ = (list_node*)&t.find_original(*rhs);
}
void next_for_new_mem(list_node *rhs, boost::stm::transaction &t)
{
- if (NULL == rhs) next_ = NULL;
+ if (0 == rhs) next_ = 0;
else next_ = &t.find_original(*rhs);
}
@@ -94,7 +94,7 @@
LinkedList()
{
#ifndef BOOST_STM_USE_BOOST_MUTEX
- pthread_mutex_init (&list_lock_, NULL);
+ pthread_mutex_init (&list_lock_, 0);
#endif
head_.value() = T();
}
@@ -181,7 +181,7 @@
list_node<T> *headP = &head_;
- if (NULL != headP->next())
+ if (0 != headP->next())
{
list_node<T> *prev = headP;
list_node<T> *cur = headP->next();
@@ -200,7 +200,7 @@
list_node<T> *curNext = cur->next();
- if (NULL == curNext) break;
+ if (0 == curNext) break;
cur = curNext;
}
@@ -211,7 +211,7 @@
// if cur->next() is null it means our newNode value is greater than
// cur, so insert ourselves after cur.
//--------------------------------------------------------------------
- if (NULL == cur->next()) cur->next(newNode);
+ if (0 == cur->next()) cur->next(newNode);
//--------------------------------------------------------------------
// otherwise, we are smaller than cur, so insert between prev and cur
//--------------------------------------------------------------------
@@ -248,7 +248,7 @@
return true;
}
- if (NULL == cur->next()) break;
+ if (0 == cur->next()) break;
}
transaction::unlock_(&list_lock_);
@@ -274,7 +274,7 @@
void outputList(std::ofstream &o)
{
int i = 0;
- for (list_node<T> *cur = head_.next(); cur != NULL; cur = cur->next())
+ for (list_node<T> *cur = head_.next(); cur != 0; cur = cur->next())
{
o << "element [" << i++ << "]: " << cur->value() << std::endl;
}
@@ -285,7 +285,7 @@
int walk_size()
{
int i = 0;
- for (list_node<T> *cur = head_.next(); cur != NULL; cur = cur->next())
+ for (list_node<T> *cur = head_.next(); cur != 0; cur = cur->next())
{
++i;
}
@@ -297,7 +297,7 @@
//--------------------------------------------------------------------------
void quick_clear()
{
- for (list_node<T> *cur = head_.next(); cur != NULL;)
+ for (list_node<T> *cur = head_.next(); cur != 0;)
{
list_node<T> *prev = cur;
cur = cur->next();
@@ -316,7 +316,7 @@
{
try
{
- for (list_node<T> *cur = t.read(head_).next(); cur != NULL;)
+ for (list_node<T> *cur = t.read(head_).next(); cur != 0;)
{
list_node<T> *prev = &t.read(*cur);
cur = t.read(*cur).next();
@@ -339,7 +339,7 @@
{
list_node<T> const *headP = &t.read(head_);
- if (NULL != headP->next())
+ if (0 != headP->next())
{
list_node<T> const *prev = headP;
list_node<T> const *cur = t.read_ptr(headP->next());
@@ -354,7 +354,7 @@
list_node<T> const *curNext = t.read_ptr(cur->next());
- if (NULL == curNext) break;
+ if (0 == curNext) break;
cur = curNext;
}
@@ -365,7 +365,7 @@
// if cur->next() is null it means our newNode value is greater than
// cur, so insert ourselves after cur.
//--------------------------------------------------------------------
- if (NULL == cur->next()) t.write_ptr((list_node<T>*)cur)->next_for_new_mem(newNode, t);
+ if (0 == cur->next()) t.write_ptr((list_node<T>*)cur)->next_for_new_mem(newNode, t);
//--------------------------------------------------------------------
// otherwise, we are smaller than cur, so insert between prev and cur
//--------------------------------------------------------------------
@@ -402,7 +402,7 @@
return true;
}
- if (NULL == trueCur->next()) break;
+ if (0 == trueCur->next()) break;
}
return false;
@@ -414,11 +414,11 @@
{
list_node<T> const *prev = &t.read(head_);
- for (list_node<T> const *cur = prev; cur != NULL; prev = cur)
+ for (list_node<T> const *cur = prev; cur != 0; prev = cur)
{
cur = t.read(*cur).next();
- if (NULL == cur) break;
+ if (0 == cur) break;
if (cur->value() == rhs.value())
{
@@ -443,7 +443,7 @@
list_node<T> const *headP = &t.read(head_);
- if (NULL != headP->next())
+ if (0 != headP->next())
{
list_node<T> const *prev = headP;
list_node<T> const *cur = t.read_ptr(headP->next());
@@ -458,7 +458,7 @@
list_node<T> const *curNext = t.read_ptr(cur->next());
- if (NULL == curNext) break;
+ if (0 == curNext) break;
cur = curNext;
}
@@ -469,7 +469,7 @@
// if cur->next() is null it means our newNode value is greater than
// cur, so insert ourselves after cur.
//--------------------------------------------------------------------
- if (NULL == cur->next()) t.write_ptr((list_node<T>*)cur)->next_for_new_mem(newNode, t);
+ if (0 == cur->next()) t.write_ptr((list_node<T>*)cur)->next_for_new_mem(newNode, t);
//--------------------------------------------------------------------
// otherwise, we are smaller than cur, so insert between prev and cur
//--------------------------------------------------------------------
@@ -498,7 +498,7 @@
list_node<T> const *prev = &t.read(head_);
- for (list_node<T> const *cur = prev; cur != NULL;
+ for (list_node<T> const *cur = prev; cur != 0;
prev = cur, cur = t.read(*cur).next())
{
if (cur->value() == rhs.value())
Modified: sandbox/stm/branches/vbe/libs/stm/test/testRBTree.cpp
==============================================================================
--- sandbox/stm/branches/vbe/libs/stm/test/testRBTree.cpp (original)
+++ sandbox/stm/branches/vbe/libs/stm/test/testRBTree.cpp 2009-10-16 05:51:04 EDT (Fri, 16 Oct 2009)
@@ -1,17 +1,17 @@
//////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Justin E. Gottchlich 2009.
-// (C) Copyright Vicente J. Botet Escriba 2009.
+// (C) Copyright Justin E. Gottchlich 2009.
+// (C) Copyright Vicente J. Botet Escriba 2009.
// Distributed under the Boost
-// Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or
+// Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or
// copy at http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org/libs/synchro for documentation.
//
//////////////////////////////////////////////////////////////////////////////
-/* The DRACO Research Group (rogue.colorado.edu/draco) */
+/* The DRACO Research Group (rogue.colorado.edu/draco) */
/*****************************************************************************\
*
* Copyright Notices/Identification of Licensor(s) of
@@ -35,7 +35,7 @@
#include <fstream>
#include <sstream>
-RedBlackTree<int> *rbTree = NULL;
+RedBlackTree<int> *rbTree = 0;
////////////////////////////////////////////////////////////////////////////
using namespace std; using namespace boost::stm;
@@ -56,7 +56,7 @@
idleUntilAllThreadsHaveReached(*(int*)threadId);
- if (kStartingTime == startTimer) startTimer = time(NULL);
+ if (kStartingTime == startTimer) startTimer = time(0);
//--------------------------------------------------------------------------
// do the transactional inserts. this is the main transactional loop.
@@ -71,7 +71,7 @@
if (kDoLookup)
{
bool allFound = true;
- int *found = NULL;
+ int *found = 0;
for (i = startingValue; i < endingValue; ++i)
{
@@ -95,7 +95,7 @@
//--------------------------------------------------------------------------
// last thread out sets the endTimer
//--------------------------------------------------------------------------
- endTimer = time(NULL);
+ endTimer = time(0);
finishThread(start);
if (*(int*)threadId != kMainThreadId)
@@ -125,7 +125,7 @@
//--------------------------------------------------------------------------
// Reset barrier variables before creating any threads. Otherwise, it is
- // possible for the first thread
+ // possible for the first thread
//--------------------------------------------------------------------------
threadsFinished.value() = 0;
threadsStarted.value() = 0;
@@ -135,7 +135,7 @@
for (int j = 0; j < kMaxThreads - 1; ++j)
{
threadId[j] = j;
- pthread_create(&threads[j], NULL, TestRedBlackTreeInserts, (void *)&threadId[j]);
+ pthread_create(&threads[j], 0, TestRedBlackTreeInserts, (void *)&threadId[j]);
}
int mainThreadId = kMaxThreads-1;
@@ -169,7 +169,7 @@
cout << " TX_SEC: " << transaction::bookkeeping().commits() / (totalAverageRunTime * runVector.size()) << endl;
cout << transaction::bookkeeping() << endl;
- if ((kInsertSameValues && totalInserts != kMaxInserts) ||
+ if ((kInsertSameValues && totalInserts != kMaxInserts) ||
(!kInsertSameValues && totalInserts != kMaxInserts * kMaxThreads))
{
std::cout << std::endl << std::endl << "###########################################################";
Modified: sandbox/stm/branches/vbe/libs/stm/test/testRBTree.h
==============================================================================
--- sandbox/stm/branches/vbe/libs/stm/test/testRBTree.h (original)
+++ sandbox/stm/branches/vbe/libs/stm/test/testRBTree.h 2009-10-16 05:51:04 EDT (Fri, 16 Oct 2009)
@@ -14,10 +14,6 @@
#ifndef RED_BLACK_TREE_H
#define RED_BLACK_TREE_H
-#ifndef NULL
-#define NULL 0
-#endif
-
#include <string>
#include <sstream>
#include <fstream>
@@ -55,7 +51,7 @@
typedef T type;
////////////////////////////////////////////////////////////////////////////
- RedBlackNode(T const &in) : color_(nRedBlackTree::eRed), value_(in),
+ RedBlackNode(T const &in) : color_(nRedBlackTree::eRed), value_(in),
left_(&sentinel), right_(&sentinel), parent_(&sentinel) {}
////////////////////////////////////////////////////////////////////////////
@@ -118,8 +114,8 @@
////////////////////////////////////////////////////////////////////////////
static void initializeSentinel()
{
- sentinel.left_ = NULL;
- sentinel.right_ = NULL;
+ sentinel.left_ = 0;
+ sentinel.right_ = 0;
sentinel.color_ = nRedBlackTree::eBlack;
}
@@ -261,7 +257,7 @@
while (x != &RedBlackNode<T>::sentinel)
{
- if (NULL == x) throw boost::stm::aborted_transaction_exception("aborting transaction");
+ if (0 == x) throw boost::stm::aborted_transaction_exception("aborting transaction");
if (x->value() == v)
{
found = &x->value();
@@ -291,11 +287,11 @@
while (x != &RedBlackNode<T>::sentinel)
{
- if (NULL == x) throw boost::stm::aborted_transaction_exception("aborting transaction");
+ if (0 == x) throw boost::stm::aborted_transaction_exception("aborting transaction");
if (x->value() == val)
{
t.lock_and_abort();
- return NULL;
+ return 0;
}
y = x;
@@ -326,10 +322,10 @@
//--------------------------------------------------------------------------
RedBlackNode<T> *x = binary_insert(newEntry, t);
- if (NULL == x) return false;
+ if (0 == x) return false;
RedBlackNode<T> *xParent = x->parent();
- //RedBlackNode<T> *xParentParent = NULL;
+ //RedBlackNode<T> *xParentParent = 0;
while (eRed == xParent->read_color(t) && xParent != &RedBlackNode<T>::sentinel)
{
@@ -428,8 +424,8 @@
{
using namespace nRedBlackTree;
- RedBlackNode<T> *y = NULL;
- RedBlackNode<T> *xParent = NULL;
+ RedBlackNode<T> *y = 0;
+ RedBlackNode<T> *xParent = 0;
while ( eBlack == x->read_color(t) && root->read_left(t) != x)
{
@@ -639,7 +635,7 @@
// find node inNode in our tree then delete it
for (; &RedBlackNode<T>::sentinel != z; )
{
- if (NULL == z) throw boost::stm::aborted_transaction_exception("altered tree");
+ if (0 == z) throw boost::stm::aborted_transaction_exception("altered tree");
if (z->value() == inNode.value()) break;
z = z->value() > inNode.value() ? z->read_left(t) : z->read_right(t);
}
Modified: sandbox/stm/branches/vbe/libs/stm/test/testatom.cpp
==============================================================================
--- sandbox/stm/branches/vbe/libs/stm/test/testatom.cpp (original)
+++ sandbox/stm/branches/vbe/libs/stm/test/testatom.cpp 2009-10-16 05:51:04 EDT (Fri, 16 Oct 2009)
@@ -78,7 +78,7 @@
pthread_exit(threadId);
}
- return NULL;
+ return 0;
}
//-----------------------------------------------------------------------------
@@ -93,7 +93,7 @@
stm::transaction::initialize();
stm::transaction::initialize_thread();
- srand(time(NULL));
+ srand(time(0));
int i = 0;
for(i = 0; i < ACCOUNTS; ++i) {
@@ -106,7 +106,7 @@
//--------------------------------------------------------------------------
// Reset barrier variables before creating any threads. Otherwise, it is
- // possible for the first thread
+ // possible for the first thread
//--------------------------------------------------------------------------
threadsFinished.value() = 0;
threadsStarted.value() = 0;
@@ -116,7 +116,7 @@
for (int j = 0; j < kMaxThreads - 1; ++j)
{
threadId[j] = j;
- pthread_create(&threads[j], NULL, AccountEntry, (void *)&threadId[j]);
+ pthread_create(&threads[j], 0, AccountEntry, (void *)&threadId[j]);
}
int mainThreadId = kMaxThreads-1;
Modified: sandbox/stm/branches/vbe/libs/stm/test/transferFun.cpp
==============================================================================
--- sandbox/stm/branches/vbe/libs/stm/test/transferFun.cpp (original)
+++ sandbox/stm/branches/vbe/libs/stm/test/transferFun.cpp 2009-10-16 05:51:04 EDT (Fri, 16 Oct 2009)
@@ -1,10 +1,10 @@
//////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Justin E. Gottchlich 2009.
-// (C) Copyright Vicente J. Botet Escriba 2009.
+// (C) Copyright Justin E. Gottchlich 2009.
+// (C) Copyright Vicente J. Botet Escriba 2009.
// Distributed under the Boost
-// Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or
+// Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or
// copy at http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org/libs/synchro for documentation.
@@ -12,7 +12,7 @@
//////////////////////////////////////////////////////////////////////////////
//---------------------------------------------------------------------------
-/* The DRACO Research Group (rogue.colorado.edu/draco) */
+/* The DRACO Research Group (rogue.colorado.edu/draco) */
/*****************************************************************************\
*
* Copyright Notices/Identification of Licensor(s) of
@@ -67,7 +67,7 @@
idleUntilAllThreadsHaveReached(*(int*)threadId);
- if (kStartingTime == startTimer) startTimer = time(NULL);
+ if (kStartingTime == startTimer) startTimer = time(0);
#if 1
@@ -87,7 +87,7 @@
//--------------------------------------------------------------------------
// last thread out sets the endTimer
//--------------------------------------------------------------------------
- endTimer = time(NULL);
+ endTimer = time(0);
finishThread(start);
if (*(int*)threadId != kMainThreadId)
@@ -119,7 +119,7 @@
//--------------------------------------------------------------------------
// Reset barrier variables before creating any threads. Otherwise, it is
- // possible for the first thread
+ // possible for the first thread
//--------------------------------------------------------------------------
threadsFinished.value() = 0;
threadsStarted.value() = 0;
@@ -129,7 +129,7 @@
for (int j = 0; j < kMaxThreads - 1; ++j)
{
threadId[j] = j;
- pthread_create(&threads[j], NULL, TestTreeTransferFunctionInserts, (void *)&threadId[j]);
+ pthread_create(&threads[j], 0, TestTreeTransferFunctionInserts, (void *)&threadId[j]);
}
int mainThreadId = kMaxThreads-1;
@@ -211,12 +211,12 @@
break;
case eSigmoid:
- output_ = 1 / (1 + pow(constantE, -input_));
+ output_ = 1 / (1 + pow(constantE, -input_));
break;
case eTanSigmoid:
- output_ = (pow(constantE, input_) - pow(constantE, -input_))
- / (pow(constantE, input_) + pow(constantE, -input_));
+ output_ = (pow(constantE, input_) - pow(constantE, -input_))
+ / (pow(constantE, input_) + pow(constantE, -input_));
break;
default:
Modified: sandbox/stm/branches/vbe/libs/stm/test/txLinearLock.cpp
==============================================================================
--- sandbox/stm/branches/vbe/libs/stm/test/txLinearLock.cpp (original)
+++ sandbox/stm/branches/vbe/libs/stm/test/txLinearLock.cpp 2009-10-16 05:51:04 EDT (Fri, 16 Oct 2009)
@@ -71,7 +71,7 @@
//--------------------------------------------------------------------------
// last thread out sets the endTimer
//--------------------------------------------------------------------------
- endTimer = time(NULL);
+ endTimer = time(0);
finishThread(start);
if (*(int*)threadId != kMainThreadId)
@@ -111,7 +111,7 @@
//--------------------------------------------------------------------------
// last thread out sets the endTimer
//--------------------------------------------------------------------------
- endTimer = time(NULL);
+ endTimer = time(0);
finishThread(start);
if (*(int*)threadId != kMainThreadId)
@@ -143,7 +143,7 @@
for (int j = 0; j < kMaxThreads - 1; ++j)
{
threadId[j] = j;
- pthread_create(&threads[j], NULL, Test1, (void *)&threadId[j]);
+ pthread_create(&threads[j], 0, Test1, (void *)&threadId[j]);
}
int mainThreadId = kMaxThreads-1;
Modified: sandbox/stm/branches/vbe/libs/stm/test/usingLockTx.cpp
==============================================================================
--- sandbox/stm/branches/vbe/libs/stm/test/usingLockTx.cpp (original)
+++ sandbox/stm/branches/vbe/libs/stm/test/usingLockTx.cpp 2009-10-16 05:51:04 EDT (Fri, 16 Oct 2009)
@@ -16,7 +16,7 @@
typedef int list_node_type;
-static newSyntaxNS::LinkedList< list_node_type > *llist = NULL;
+static newSyntaxNS::LinkedList< list_node_type > *llist = 0;
#ifndef BOOST_STM_USE_BOOST_MUTEX
static Mutex L = PTHREAD_MUTEX_INITIALIZER;
@@ -128,7 +128,7 @@
idleUntilAllThreadsHaveReached(*(int*)threadId);
- if (kStartingTime == startTimer) startTimer = time(NULL);
+ if (kStartingTime == startTimer) startTimer = time(0);
//--------------------------------------------------------------------------
// do the transactional inserts. this is the main transactional loop.
@@ -182,7 +182,7 @@
//--------------------------------------------------------------------------
// last thread out sets the endTimer
//--------------------------------------------------------------------------
- endTimer = time(NULL);
+ endTimer = time(0);
finishThread(start);
if (*(int*)threadId != kMainThreadId)
@@ -210,7 +210,7 @@
idleUntilAllThreadsHaveReached(*(int*)threadId);
- if (kStartingTime == startTimer) startTimer = time(NULL);
+ if (kStartingTime == startTimer) startTimer = time(0);
//--------------------------------------------------------------------------
// do the transactional inserts. this is the main transactional loop.
@@ -263,7 +263,7 @@
//--------------------------------------------------------------------------
// last thread out sets the endTimer
//--------------------------------------------------------------------------
- endTimer = time(NULL);
+ endTimer = time(0);
finishThread(start);
if (*(int*)threadId != kMainThreadId)
@@ -405,7 +405,7 @@
pthread_t *second_thread = new pthread_t;
- pthread_create(second_thread, NULL, stall, (void*)NULL);
+ pthread_create(second_thread, 0, stall, (void*)0);
TestTransactionInsideLock();
TestEarlyRelease();
@@ -441,10 +441,10 @@
for (int j = 0; j < kMaxThreads - 1; ++j)
{
threadId[j] = j;
- //if (0 == j % 2) pthread_create(&threads[j], NULL, TestLinkedListInserts, (void *)&threadId[j]);
- //else pthread_create(&threads[j], NULL, TestLinkedListInsertsWithLocks, (void *)&threadId[j]);
+ //if (0 == j % 2) pthread_create(&threads[j], 0, TestLinkedListInserts, (void *)&threadId[j]);
+ //else pthread_create(&threads[j], 0, TestLinkedListInsertsWithLocks, (void *)&threadId[j]);
- pthread_create(&threads[j], NULL, tx_foo, (void*)&threadId[j]);
+ pthread_create(&threads[j], 0, tx_foo, (void*)&threadId[j]);
}
int mainThreadId = kMaxThreads-1;
Modified: sandbox/stm/branches/vbe/libs/stm/test/usingLockTx.h
==============================================================================
--- sandbox/stm/branches/vbe/libs/stm/test/usingLockTx.h (original)
+++ sandbox/stm/branches/vbe/libs/stm/test/usingLockTx.h 2009-10-16 05:51:04 EDT (Fri, 16 Oct 2009)
@@ -35,10 +35,10 @@
public:
list_node() : value_(0), next_(0) {}
- explicit list_node(int const &rhs) : value_(rhs), next_(NULL) {}
+ explicit list_node(int const &rhs) : value_(rhs), next_(0) {}
// zero initialization for native types
- void clear() { value_ = T(); next_ = NULL; }
+ void clear() { value_ = T(); next_ = 0; }
T &value() { return value_; }
T const &value() const { return value_; }
@@ -50,13 +50,13 @@
void next(list_node const *rhs, boost::stm::transaction &t)
{
- if (NULL == rhs) next_ = NULL;
+ if (0 == rhs) next_ = 0;
else next_ = &t.find_original(*(list_node<T>*)rhs);
}
void next_for_new_mem(list_node *rhs, boost::stm::transaction &t)
{
- if (NULL == rhs) next_ = NULL;
+ if (0 == rhs) next_ = 0;
else next_ = &t.find_original(*rhs);
}
@@ -95,7 +95,7 @@
LinkedList()
{
#ifndef BOOST_STM_USE_BOOST_MUTEX
- pthread_mutex_init (&list_lock_, NULL);
+ pthread_mutex_init (&list_lock_, 0);
#endif
head_.value() = T();
}
@@ -183,7 +183,7 @@
{
list_node<T> *headP = &head_;
- if (NULL != headP->next())
+ if (0 != headP->next())
{
list_node<T> *prev = headP;
list_node<T> *cur = headP->next();
@@ -201,7 +201,7 @@
list_node<T> *curNext = cur->next();
- if (NULL == curNext) break;
+ if (0 == curNext) break;
cur = curNext;
}
@@ -212,7 +212,7 @@
// if cur->next() is null it means our newNode value is greater than
// cur, so insert ourselves after cur.
//--------------------------------------------------------------------
- if (NULL == cur->next()) cur->next(newNode);
+ if (0 == cur->next()) cur->next(newNode);
//--------------------------------------------------------------------
// otherwise, we are smaller than cur, so insert between prev and cur
//--------------------------------------------------------------------
@@ -248,7 +248,7 @@
return true;
}
- if (NULL == cur->next()) break;
+ if (0 == cur->next()) break;
}
transaction::unlock_(&list_lock_);
@@ -274,7 +274,7 @@
void outputList(std::ofstream &o)
{
int i = 0;
- for (list_node<T> *cur = head_.next(); cur != NULL; cur = cur->next())
+ for (list_node<T> *cur = head_.next(); cur != 0; cur = cur->next())
{
o << "element [" << i++ << "]: " << cur->value() << std::endl;
}
@@ -285,7 +285,7 @@
int walk_size()
{
int i = 0;
- for (list_node<T> *cur = head_.next(); cur != NULL; cur = cur->next())
+ for (list_node<T> *cur = head_.next(); cur != 0; cur = cur->next())
{
++i;
}
@@ -297,7 +297,7 @@
//--------------------------------------------------------------------------
void quick_clear()
{
- for (list_node<T> *cur = head_.next(); cur != NULL;)
+ for (list_node<T> *cur = head_.next(); cur != 0;)
{
list_node<T> *prev = cur;
cur = cur->next();
@@ -316,7 +316,7 @@
{
try
{
- for (list_node<T> *cur = t.read(head_).next(); cur != NULL;)
+ for (list_node<T> *cur = t.read(head_).next(); cur != 0;)
{
list_node<T> *prev = &t.read(*cur);
cur = t.read(*cur).next();
@@ -339,7 +339,7 @@
{
list_node<T> const *headP = &t.read(head_);
- if (NULL != headP->next())
+ if (0 != headP->next())
{
list_node<T> const *prev = headP;
list_node<T> const *cur = t.read_ptr(headP->next());
@@ -354,7 +354,7 @@
list_node<T> const *curNext = t.read_ptr(cur->next());
- if (NULL == curNext) break;
+ if (0 == curNext) break;
cur = curNext;
}
@@ -365,7 +365,7 @@
// if cur->next() is null it means our newNode value is greater than
// cur, so insert ourselves after cur.
//--------------------------------------------------------------------
- if (NULL == cur->next()) t.write_ptr((list_node<T>*)cur)->next_for_new_mem(newNode, t);
+ if (0 == cur->next()) t.write_ptr((list_node<T>*)cur)->next_for_new_mem(newNode, t);
//--------------------------------------------------------------------
// otherwise, we are smaller than cur, so insert between prev and cur
//--------------------------------------------------------------------
@@ -402,7 +402,7 @@
return true;
}
- if (NULL == trueCur->next()) break;
+ if (0 == trueCur->next()) break;
}
return false;
@@ -414,11 +414,11 @@
{
list_node<T> const *prev = &t.read(head_);
- for (list_node<T> const *cur = prev; cur != NULL; prev = cur)
+ for (list_node<T> const *cur = prev; cur != 0; prev = cur)
{
cur = t.read(*cur).next();
- if (NULL == cur) break;
+ if (0 == cur) break;
if (cur->value() == rhs.value())
{
@@ -443,7 +443,7 @@
list_node<T> const *headP = &t.read(head_);
- if (NULL != headP->next())
+ if (0 != headP->next())
{
list_node<T> const *prev = headP;
list_node<T> const *cur = t.read_ptr(headP->next());
@@ -458,7 +458,7 @@
list_node<T> const *curNext = t.read_ptr(cur->next());
- if (NULL == curNext) break;
+ if (0 == curNext) break;
cur = curNext;
}
@@ -469,7 +469,7 @@
// if cur->next() is null it means our newNode value is greater than
// cur, so insert ourselves after cur.
//--------------------------------------------------------------------
- if (NULL == cur->next()) t.write_ptr((list_node<T>*)cur)->next_for_new_mem(newNode, t);
+ if (0 == cur->next()) t.write_ptr((list_node<T>*)cur)->next_for_new_mem(newNode, t);
//--------------------------------------------------------------------
// otherwise, we are smaller than cur, so insert between prev and cur
//--------------------------------------------------------------------
@@ -498,7 +498,7 @@
list_node<T> const *prev = &t.read(head_);
- for (list_node<T> const *cur = prev; cur != NULL;
+ for (list_node<T> const *cur = prev; cur != 0;
prev = cur, cur = t.read(*cur).next())
{
if (cur->value() == rhs.value())
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk