Skip to content

Commit c32b058

Browse files
committed
Code consistency improvements
1 parent 699c343 commit c32b058

File tree

5 files changed

+19
-20
lines changed

5 files changed

+19
-20
lines changed

README.md

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ enki::TaskScheduler g_TS;
6767

6868
// define a task set, can ignore range if we only do one thing
6969
struct ParallelTaskSet : enki::ITaskSet {
70-
virtual void ExecuteRange( enki::TaskSetPartition range, uint32_t threadnum ) {
70+
void ExecuteRange( enki::TaskSetPartition range_, uint32_t threadnum_ ) override {
7171
// do something here, can issue tasks with g_TS
7272
}
7373
};
@@ -94,7 +94,7 @@ enki::TaskScheduler g_TS;
9494
int main(int argc, const char * argv[]) {
9595
g_TS.Initialize();
9696
97-
enki::TaskSet task( 1, []( enki::TaskSetPartition range, uint32_t threadnum ) {
97+
enki::TaskSet task( 1, []( enki::TaskSetPartition range_, uint32_t threadnum_ ) {
9898
// do something here
9999
} );
100100
@@ -117,7 +117,7 @@ struct ExampleTask : enki::ITaskSet
117117
{
118118
ExampleTask( ) { m_SetSize = size_; }
119119

120-
virtual void ExecuteRange( enki::TaskSetPartition range, uint32_t threadnum ) {
120+
void ExecuteRange( enki::TaskSetPartition range_, uint32_t threadnum_ ) override {
121121
// See full example in Priorities.cpp
122122
}
123123
};
@@ -161,7 +161,7 @@ enki::TaskScheduler g_TS;
161161
162162
// define a task set, can ignore range if we only do one thing
163163
struct PinnedTask : enki::IPinnedTask {
164-
virtual void Execute() {
164+
void Execute() override {
165165
// do something here, can issue tasks with g_TS
166166
}
167167
};
@@ -192,14 +192,14 @@ enki::TaskScheduler g_TS;
192192

193193
// define a task set, can ignore range if we only do one thing
194194
struct TaskA : enki::ITaskSet {
195-
virtual void ExecuteRange( enki::TaskSetPartition range, uint32_t threadnum ) {
195+
void ExecuteRange( enki::TaskSetPartition range_, uint32_t threadnum_ ) override {
196196
// do something here, can issue tasks with g_TS
197197
}
198198
};
199199

200200
struct TaskB : enki::ITaskSet {
201201
enki::Dependency m_Dependency;
202-
virtual void ExecuteRange( enki::TaskSetPartition range, uint32_t threadnum ) {
202+
void ExecuteRange( enki::TaskSetPartition range_, uint32_t threadnum_ ) override {
203203
// do something here, can issue tasks with g_TS
204204
}
205205
};
@@ -227,8 +227,7 @@ External thread usage in C++:
227227
enki::TaskScheduler g_TS;
228228
struct ParallelTaskSet : ITaskSet
229229
{
230-
virtual void ExecuteRange( TaskSetPartition range, uint32_t threadnum )
231-
{
230+
void ExecuteRange( enki::TaskSetPartition range_, uint32_t threadnum_ ) override {
232231
// Do something
233232
}
234233
};
@@ -268,7 +267,7 @@ C usage:
268267

269268
enkiTaskScheduler* g_pTS;
270269

271-
void ParalleTaskSetFunc( uint32_t start_, uint32_t end, uint32_t threadnum_, void* pArgs_ ) {
270+
void ParalleTaskSetFunc( uint32_t start_, uint32_t end_, uint32_t threadnum_, void* pArgs_ ) {
272271
/* Do something here, can issue tasks with g_pTS */
273272
}
274273

example/CompletionAction.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,11 @@ struct SelfDeletingTaskB : ITaskSet
7070
printf("~SelfDeletingTaskB() called on thread %u\n\n", g_TS.GetThreadNum() );
7171
}
7272

73-
void ExecuteRange( TaskSetPartition range, uint32_t threadnum ) override
73+
void ExecuteRange( TaskSetPartition range_, uint32_t threadnum_ ) override
7474
{
75-
(void)range;
75+
(void)range_;
7676
++gs_CountBsRun;
77-
printf("SelfDeletingTaskB on thread %u\n", threadnum);
77+
printf("SelfDeletingTaskB on thread %u\n", threadnum_);
7878
}
7979

8080
CompletionActionDelete m_TaskDeleter;
@@ -97,11 +97,11 @@ struct SelfDeletingTaskA : ITaskSet
9797
printf("~SelfDeletingTaskA() called on thread %u\n\n", g_TS.GetThreadNum() );
9898
}
9999

100-
void ExecuteRange( TaskSetPartition range, uint32_t threadnum ) override
100+
void ExecuteRange( TaskSetPartition range_, uint32_t threadnum_ ) override
101101
{
102-
(void)range;
102+
(void)range_;
103103
++gs_CountAsRun;
104-
printf("SelfDeletingTaskA on thread %u\n", threadnum);
104+
printf("SelfDeletingTaskA on thread %u\n", threadnum_);
105105
}
106106

107107
CompletionActionDelete m_TaskDeleter;

example/CustomAllocator_c.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ void* CustomAllocFunc( size_t align_, size_t size_, void* userData_, const char*
5151
return enkiDefaultAllocFunc( align_, size_, userData_, file_, line_ );
5252
};
5353

54-
void CustomFreeFunc( void* ptr_, size_t size_, void* userData_, const char* file_, int line_ )
54+
void CustomFreeFunc( void* ptr_, size_t size_, void* userData_, const char* file_, int line_ )
5555
{
5656
totalAllocations -= size_; // note this isn't thread safe, should use atomics in real application
5757

example/ParallelSum_c.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,15 @@ typedef struct ParallelSumTaskSetArgs
3030
uint32_t numPartialSums;
3131
} ParallelSumTaskSetArgs;
3232

33-
void ParallelSumTaskSetFunc( uint32_t start_, uint32_t end, uint32_t threadnum_, void* pArgs_ )
33+
void ParallelSumTaskSetFunc( uint32_t start_, uint32_t end_, uint32_t threadnum_, void* pArgs_ )
3434
{
3535
ParallelSumTaskSetArgs args;
3636
uint64_t sum, i;
3737

3838
args = *(ParallelSumTaskSetArgs*)pArgs_;
3939

4040
sum = args.pPartialSums[threadnum_];
41-
for( i = start_; i < end; ++i )
41+
for( i = start_; i < end_; ++i )
4242
{
4343
sum += i + 1;
4444
}
@@ -53,7 +53,7 @@ typedef struct ParallelReductionSumTaskSetArgs
5353
uint64_t sum;
5454
} ParallelReductionSumTaskSetArgs;
5555

56-
void ParallelReductionSumTaskSetFunc( uint32_t start_, uint32_t end, uint32_t threadnum_, void* pArgs_ )
56+
void ParallelReductionSumTaskSetFunc( uint32_t start_, uint32_t end_, uint32_t threadnum_, void* pArgs_ )
5757
{
5858
ParallelReductionSumTaskSetArgs* pArgs;
5959
uint64_t sum, i;

src/TaskScheduler_c.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ typedef struct enkiCompletable enkiCompletable;
5353
typedef struct enkiDependency enkiDependency;
5454
typedef struct enkiCompletionAction enkiCompletionAction;
5555

56-
typedef void (* enkiTaskExecuteRange)( uint32_t start_, uint32_t end, uint32_t threadnum_, void* pArgs_ );
56+
typedef void (* enkiTaskExecuteRange)( uint32_t start_, uint32_t end_, uint32_t threadnum_, void* pArgs_ );
5757
typedef void (* enkiPinnedTaskExecute)( void* pArgs_ );
5858
typedef void (* enkiCompletionFunction)( void* pArgs_, uint32_t threadNum_ );
5959

0 commit comments

Comments
 (0)