Skip to content

Commit 56ad347

Browse files
Merge pull request taskflow#167 from matt77hias/master
size_t instead of unsigned
2 parents 7cc2f38 + 9609bfe commit 56ad347

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

taskflow/core/observer.hpp

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -39,21 +39,21 @@ class ObserverInterface {
3939
@brief constructor-like method to call when the executor observer is fully created
4040
@param num_workers the number of the worker threads in the executor
4141
*/
42-
virtual void set_up(unsigned num_workers) = 0;
42+
virtual void set_up(size_t num_workers) = 0;
4343

4444
/**
4545
@brief method to call before a worker thread executes a closure
4646
@param worker_id the id of this worker thread
4747
@param task_view a constant wrapper object to the task
4848
*/
49-
virtual void on_entry(unsigned worker_id, TaskView task_view) = 0;
49+
virtual void on_entry(size_t worker_id, TaskView task_view) = 0;
5050

5151
/**
5252
@brief method to call after a worker thread executed a closure
5353
@param worker_id the id of this worker thread
5454
@param task_view a constant wrapper object to the task
5555
*/
56-
virtual void on_exit(unsigned worker_id, TaskView task_view) = 0;
56+
virtual void on_exit(size_t worker_id, TaskView task_view) = 0;
5757
};
5858

5959
// ----------------------------------------------------------------------------
@@ -123,9 +123,9 @@ class ChromeTracingObserver : public ObserverInterface {
123123

124124
private:
125125

126-
inline void set_up(unsigned num_workers) override final;
127-
inline void on_entry(unsigned worker_id, TaskView task_view) override final;
128-
inline void on_exit(unsigned worker_id, TaskView task_view) override final;
126+
inline void set_up(size_t num_workers) override final;
127+
inline void on_entry(size_t worker_id, TaskView task_view) override final;
128+
inline void on_exit(size_t worker_id, TaskView task_view) override final;
129129

130130
Timeline _timeline;
131131
};
@@ -148,26 +148,26 @@ inline ChromeTracingObserver::Segment::Segment(
148148
}
149149

150150
// Procedure: set_up
151-
inline void ChromeTracingObserver::set_up(unsigned num_workers) {
151+
inline void ChromeTracingObserver::set_up(size_t num_workers) {
152152

153153
_timeline.segments.resize(num_workers);
154154

155-
for(unsigned w=0; w<num_workers; ++w) {
155+
for(size_t w=0; w<num_workers; ++w) {
156156
_timeline.segments[w].reserve(32);
157157
}
158158

159159
_timeline.origin = std::chrono::steady_clock::now();
160160
}
161161

162162
// Procedure: on_entry
163-
inline void ChromeTracingObserver::on_entry(unsigned w, TaskView tv) {
163+
inline void ChromeTracingObserver::on_entry(size_t w, TaskView tv) {
164164
_timeline.segments[w].emplace_back(
165165
tv.name(), std::chrono::steady_clock::now()
166166
);
167167
}
168168

169169
// Procedure: on_exit
170-
inline void ChromeTracingObserver::on_exit(unsigned w, TaskView) {
170+
inline void ChromeTracingObserver::on_exit(size_t w, TaskView) {
171171
assert(_timeline.segments[w].size() > 0);
172172
_timeline.segments[w].back().end = std::chrono::steady_clock::now();
173173
}
@@ -322,9 +322,9 @@ class TFProfObserver : public ObserverInterface {
322322

323323
private:
324324

325-
inline void set_up(unsigned num_workers) override final;
326-
inline void on_entry(unsigned worker_id, TaskView task_view) override final;
327-
inline void on_exit(unsigned worker_id, TaskView task_view) override final;
325+
inline void set_up(size_t num_workers) override final;
326+
inline void on_entry(size_t worker_id, TaskView task_view) override final;
327+
inline void on_exit(size_t worker_id, TaskView task_view) override final;
328328

329329
Timeline _timeline;
330330

@@ -351,26 +351,26 @@ inline TFProfObserver::Segment::Segment(
351351
}
352352

353353
// Procedure: set_up
354-
inline void TFProfObserver::set_up(unsigned num_workers) {
354+
inline void TFProfObserver::set_up(size_t num_workers) {
355355

356356
_timeline.segments.resize(num_workers);
357357

358-
for(unsigned w=0; w<num_workers; ++w) {
358+
for(size_t w=0; w<num_workers; ++w) {
359359
_timeline.segments[w].reserve(32);
360360
}
361361

362362
_timeline.origin = std::chrono::steady_clock::now();
363363
}
364364

365365
// Procedure: on_entry
366-
inline void TFProfObserver::on_entry(unsigned w, TaskView tv) {
366+
inline void TFProfObserver::on_entry(size_t w, TaskView tv) {
367367
_timeline.segments[w].emplace_back(
368368
tv.name(), tv.type(), std::chrono::steady_clock::now()
369369
);
370370
}
371371

372372
// Procedure: on_exit
373-
inline void TFProfObserver::on_exit(unsigned w, TaskView) {
373+
inline void TFProfObserver::on_exit(size_t w, TaskView) {
374374
assert(_timeline.segments[w].size() > 0);
375375
_timeline.segments[w].back().end = std::chrono::steady_clock::now();
376376
}

0 commit comments

Comments
 (0)