Back to index

nordugrid-arc-nox  1.1.0~rc6
Public Member Functions | Private Member Functions | Static Private Member Functions | Static Private Attributes
ThreadTest Class Reference

List of all members.

Public Member Functions

void setUp ()
void tearDown ()
void TestThread ()

Private Member Functions

 CPPUNIT_TEST_SUITE (ThreadTest)
 CPPUNIT_TEST (TestThread)
 CPPUNIT_TEST_SUITE_END ()

Static Private Member Functions

static void func (void *)

Static Private Attributes

static int counter = 0
static Glib::Mutex * lock = NULL

Detailed Description

Definition at line 9 of file ThreadTest.cpp.


Member Function Documentation

void ThreadTest::func ( void *  ) [static, private]

Definition at line 47 of file ThreadTest.cpp.

                           {
  sleep(1);
  lock->lock();
  ++counter;
  lock->unlock();
}

Here is the caller graph for this function:

Definition at line 28 of file ThreadTest.cpp.

                       {
  counter = 0;
  lock = new Glib::Mutex;
}

Definition at line 34 of file ThreadTest.cpp.

                          {
  if(lock) delete lock;
}

Definition at line 38 of file ThreadTest.cpp.

                            {
  // Simply run 500 threads and see if executable crashes
  for(int n = 0;n<500;++n) {
    CPPUNIT_ASSERT(Arc::CreateThreadFunction(&func,NULL));
  }
  sleep(30);
  CPPUNIT_ASSERT_EQUAL(500,counter);
}

Here is the call graph for this function:


Member Data Documentation

int ThreadTest::counter = 0 [static, private]

Definition at line 23 of file ThreadTest.cpp.

Glib::Mutex * ThreadTest::lock = NULL [static, private]

Definition at line 24 of file ThreadTest.cpp.


The documentation for this class was generated from the following file: