33 #include "utilities/debug.hpp"
34 #include "utilities/globalDefinitions.hpp"
35
36 // Task class hierarchy:
37 // AbstractGangTask
38 //
39 // Gang/Group class hierarchy:
40 // AbstractWorkGang
41 // WorkGang
42 // YieldingFlexibleWorkGang (defined in another file)
43 //
44 // Worker class hierarchy:
45 // AbstractGangWorker (subclass of WorkerThread)
46 // GangWorker
47 // YieldingFlexibleGangWorker (defined in another file)
48
49 // Forward declarations of classes defined here
50
51 class AbstractGangWorker;
52 class Semaphore;
53 class WorkGang;
54
55 // An abstract task to be worked on by a gang.
56 // You subclass this to supply your own work() method
57 class AbstractGangTask {
58 const char* _name;
59 const uint _gc_id;
60
61 public:
62 explicit AbstractGangTask(const char* name) :
63 _name(name),
64 _gc_id(GCId::current_or_undefined())
65 {}
66
67 // The abstract work method.
68 // The argument tells you which member of the gang you are.
69 virtual void work(uint worker_id) = 0;
70
71 // Debugging accessor for the name.
72 const char* name() const { return _name; }
|
33 #include "utilities/debug.hpp"
34 #include "utilities/globalDefinitions.hpp"
35
36 // Task class hierarchy:
37 // AbstractGangTask
38 //
39 // Gang/Group class hierarchy:
40 // AbstractWorkGang
41 // WorkGang
42 // YieldingFlexibleWorkGang (defined in another file)
43 //
44 // Worker class hierarchy:
45 // AbstractGangWorker (subclass of WorkerThread)
46 // GangWorker
47 // YieldingFlexibleGangWorker (defined in another file)
48
49 // Forward declarations of classes defined here
50
51 class AbstractGangWorker;
52 class Semaphore;
53 class ThreadClosure;
54 class WorkGang;
55
56 // An abstract task to be worked on by a gang.
57 // You subclass this to supply your own work() method
58 class AbstractGangTask {
59 const char* _name;
60 const uint _gc_id;
61
62 public:
63 explicit AbstractGangTask(const char* name) :
64 _name(name),
65 _gc_id(GCId::current_or_undefined())
66 {}
67
68 // The abstract work method.
69 // The argument tells you which member of the gang you are.
70 virtual void work(uint worker_id) = 0;
71
72 // Debugging accessor for the name.
73 const char* name() const { return _name; }
|