1 // Copyright (C) 2006-2014 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #ifndef _BASESTEST_HXX_
21 #define _BASESTEST_HXX_
23 #include <cppunit/extensions/HelperMacros.h>
26 #include "Semaphore.hxx"
27 #include "DynLibLoader.hxx"
31 class BasesTest: public CppUnit::TestFixture
33 CPPUNIT_TEST_SUITE( BasesTest );
34 CPPUNIT_TEST( test1 );
35 CPPUNIT_TEST( test2 );
36 CPPUNIT_TEST( test3 );
37 CPPUNIT_TEST( testDL );
38 CPPUNIT_TEST_SUITE_END();
53 static void *th1_1(void *);
54 static void *th1_2(void *);
55 static void *th1_3(void *);
56 static void *th2_1(void *);
58 static void *myFunc(void *);
59 static void get_resources(int id, int amount);
60 static void free_resources(int id, int amount);
61 static int count_resources();
64 static std::ostringstream _glob;
65 static YACS::BASES::Mutex _m;
66 static YACS::BASES::Semaphore _s1;
67 static YACS::BASES::Semaphore _s2;
68 static YACS::BASES::Condition _cond;
70 static const int THREAD_NUM;
71 static const int LOOPS;
72 static const int MAX_RESOURCE;
75 static int _resources;
76 static int _ownedResources[];