31 std::bitset<TwoPowerD> entryMissing = 0;
40 if ( entryMissing.any() ) {
42 insertNumber( numbers[i] );
49 return _globalEnumerator.getNumber();
54 _globalEnumerator.releaseNumber(value);
59 return _globalEnumerator.size();
64 return _globalEnumerator.toString();
69 std::bitset<TwoPowerD> gotAllLocks = 0;
75 insertNumbers(numbers);
77 while (not gotAllLocks.all()) {
82 gotAllLocks[counter] =
true;
85 assertionEquals2( _resources.count(numbers[counter]), 1, counter, numbers[counter] );
87 *_resources.at( numbers[counter] ),
90 gotAllLocks[counter] = lock.
tryLock();
92 if (gotAllLocks[counter]) {
100 if (not gotAllLocks.all()) {
102 if (gotAllLocks[i]) {
103 gotAllLocks[i] =
false;
106 *_resources.at( numbers[i] ),
124 assertion1( _resources.count(numbers[i])==1, numbers[i] );
126 *_resources.at( numbers[i] ),
#define assertion2(expr, param0, param1)
#define assertionEquals1(lhs, rhs, a)
#define assertion1(expr, param)
#define assertionEquals2(lhs, rhs, a, b)
int size() const
Number of numbers handed out so far.
static void insertNumber(int number)
Create a new number.
static void insertNumbers(const tarch::la::Vector< TwoPowerD, int > &numbers)
static std::map< int, tarch::multicore::BooleanSemaphore * > _resources
Each task is tied to a resource, i.e.
static void unlockResources(const tarch::la::Vector< TwoPowerD, int > &numbers)
Free resources.
static ResourcesSemaphore _resourcesSemaphore
int getNumber()
Create a new task number.
static tarch::Enumerator _globalEnumerator
void releaseNumber(int value)
Free task number.
std::string toString() const
Decorator for tarch::Enumerator::toString().
static void lockResources(const tarch::la::Vector< TwoPowerD, int > &numbers)
Lock resources.
Simple rank-global enumerator.
static constexpr int NoNumber
static Core & getInstance()
void yield()
Wrapper around backend-specific yield.
Create a lock around a boolean semaphore region.
void free()
Free the lock.
Create a lock around a boolean semaphore region.