Zen API

- Home
- Topics
- Types
- Files

All Classes Files Functions Variables Typedefs Friends Macros Modules Pages
kParallel.h
Go to the documentation of this file.
1
10 #ifndef K_API_PARALLEL_H
11 #define K_API_PARALLEL_H
12
13 #include <kApi/kApiDef.h>
14
21 typedef struct kParallelArgs
22 {
23 kPointer content;
24 kSize index;
25 kSize count;
26 } kParallelArgs;
27
45 kFx(kSize) kParallelArgs_Begin(const kParallelArgs* args, kSize start, kSize count);
46
64 kFx(kSize) kParallelArgs_End(const kParallelArgs* args, kSize start, kSize count);
65
67 typedef kStatus(kCall* kParallelFx)(kPointer receiver, kParallel sender, kParallelArgs* args);
68
74 typedef kPointer kParallelTransaction;
75
76 #include <kApi/Threads/kParallel.x.h>
77
117 //typedef kObject kParallel; --forward-declared in kFsDef.x.h
118
134 kFx(kStatus) kParallel_Execute(kParallelFx callback, kPointer receiver, kPointer content);
135
152 kFx(kStatus) kParallel_BeginExecute(kParallelFx callback, kPointer receiver, kPointer content, kParallelTransaction* transaction);
153
163 kFx(kStatus) kParallel_EndExecute(kParallelTransaction transaction);
164
179 kFx(kStatus) kParallel_ExecuteDirect(kParallelFx callback, kPointer receiver, kPointer content);
180
194 kInlineFx(kSize) kParallel_ThreadCount()
195 {
196 return kThreadPool_Count(kThreadPool_Default());
197 }
198
199 #endif
kParallel::kParallel_ExecuteDirect
kStatus kParallel_ExecuteDirect(kParallelFx callback, kPointer receiver, kPointer content)
Directly invokes the specified callback without using the thread pool.
kParallelTransaction
Opaque pointer to a kParallel transaction.
kPointer
Represents a void pointer.
kParallel
Declares the kParallel class.
kParallelArgs::index
kSize index
Index of current processing callback (0..count-1).
Definition: kParallel.h:24
kSize
Represents an unsigned integer that can store a pointer address.
kInlineFx
#define kInlineFx(TYPE)
Inline method declaration helper.
Definition: kApiDef.h:26
kParallel::kParallel_BeginExecute
kStatus kParallel_BeginExecute(kParallelFx callback, kPointer receiver, kPointer content, kParallelTransaction *transaction)
Begins asynchronously processing a dataset.
kParallelArgs::content
kPointer content
Shared data content, to be processed by callbacks.
Definition: kParallel.h:23
kParallel::kParallel_ThreadCount
kSize kParallel_ThreadCount()
Reports the number of threads that will be used to process a parallel transaction.
Definition: kParallel.h:194
kParallelArgs
Arguments received by a kParallel data processing callback.
Definition: kParallel.h:21
kThreadPool::kThreadPool_Default
kThreadPool kThreadPool_Default()
Returns the default thread pool.
kThreadPool::kThreadPool_Count
kSize kThreadPool_Count(kThreadPool pool)
Returns the number of threads in the pool.
kParallelFx
kStatus(kCall * kParallelFx)(kPointer receiver, kParallel sender, kParallelArgs *args)
kParallel data processing callback signature.
Definition: kParallel.h:67
kApiDef.h
Core Zen type declarations.
kParallelArgs::kParallelArgs_End
kSize kParallelArgs_End(const kParallelArgs *args, kSize start, kSize count)
Helper method that can be used to calculate the data end index within a kParallel callback...
kParallel::kParallel_EndExecute
kStatus kParallel_EndExecute(kParallelTransaction transaction)
Blocks until execution of the specified kParallel transaction is complete.
kStatus
Represents an error code.
kParallelArgs::count
kSize count
Total number of processing callbacks (1 or more).
Definition: kParallel.h:25
kCall
#define kCall
kApi standard function calling convention.
Definition: kApiDef.h:15
kParallel::kParallel_Execute
kStatus kParallel_Execute(kParallelFx callback, kPointer receiver, kPointer content)
Synchronously processes a dataset.
kParallelArgs::kParallelArgs_Begin
kSize kParallelArgs_Begin(const kParallelArgs *args, kSize start, kSize count)
Helper method that can be used to calculate the data start index within a kParallel callback...