Peano
Loading...
Searching...
No Matches
TaskEnumerator.h
Go to the documentation of this file.
1// This file is part of the SWIFT2 project. For conditions of distribution and
2// use, please see the copyright notice at www.peano-framework.org
3#pragma once
4
5#include "tarch/Enumerator.h"
6#include "tarch/la/Vector.h"
8
11
12#include <map>
13
14namespace swift2 {
15 class TaskEnumerator;
16}
17
18
54 public:
55 TaskEnumerator() = default;
56
57 void reset();
58
83 int getNumber();
84
94 void releaseNumber( int value );
95
101 int size() const;
102
106 std::string toString() const;
107
143 static void lockResources( const tarch::la::Vector<TwoPowerD,int>& numbers );
144
152 static void unlockResources( const tarch::la::Vector<TwoPowerD,int>& numbers );
153
154 private:
156
161 static std::map< int, tarch::multicore::BooleanSemaphore* > _resources;
162
176
178
185 static void insertNumber(int number);
186 static void insertNumbers(const tarch::la::Vector<TwoPowerD,int>& numbers);
187};
188
Task enumerator for Swift 2.
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.
Definition Enumerator.h:24
This file is part of the SWIFT 2 project.
Simple vector class.
Definition Vector.h:150