-
首页
-
C4D R23.110 C++ SDK
StaticJobGroupInterface< T > Class Template Reference
线程
#include <jobgroup.h>
详细描述
template<typename T>
class maxon::StaticJobGroupInterface< T >
This is a template for homogenous static job group (all job of the same type and the number of jobs is known at creation). Once you have allocated a StaticJobGroup you cannot add more than the number of jobs specified and you cannot add jobs of a different type than specified in the template. Nonetheless you can add as many subgroups as you want.
构造函数 & 析构函数文档编制
◆
~StaticJobGroupInterface()
成员函数文档编制
◆
Add()
[1/7]
Adds an array with multiple jobs of the same type to the group (faster than single
Add()
s).
-
参数
-
◆
Alloc()
Allocates a StaticJobGroup.
-
参数
-
[in]
|
jobCnt
|
The maximum number of jobs for this group.
|
[in]
|
flags
|
STATICJOBGROUPFLAGS::DEFAULT
by default, the other custom modes are for
ParallelFor
only.
|
[in]
|
extraBufferSize
|
By default 0. Size of a private buffer that can be allocated together with the group.
|
-
返回
-
StaticJobGroupInterface
pointer or nullptr if allocation failed.
◆
ToString()
Returns a readable string of the content.
-
参数
-
[in]
|
formatStatement
|
Nullptr or additional formatting instruction. Currently no additional formatting instructions are supported.
|
-
返回
-
The converted result.
◆
Add()
[2/7]
Adds a job to the group. The group takes
exclusive
ownership of the job. The job will be deleted after it has been executed, when the group will be deleted or when adding the job fails. The job must have been created using
DefaultAllocator
, e.g. with Create() or
NewObj()
. If you had created a job on the stack or used a custom allocator this would lead to a crash. As long as the group is not enqueued you can add jobs from any thread. As soon as it is enqueued only jobs belonging to the group are allowed to add further jobs. THREADSAFE.
-
参数
-
[in]
|
job
|
Job (nullptr will return error).
|
-
返回
-
OK on success.
◆
Add()
[3/7]
Adds a job to the group. The group takes
exclusive
ownership of the job. The job will be deleted after it has been executed, when the group will be deleted or when adding the job fails. The job must have been created using
DefaultAllocator
, e.g. with Create() or
NewObj()
. If you had created a job on the stack or used a custom allocator this would lead to a crash. As long as the group is not enqueued you can add jobs from any thread. As soon as it is enqueued only jobs belonging to the group are allowed to add further jobs. THREADSAFE.
-
参数
-
[in]
|
job
|
Job (nullptr will return error).
|
-
返回
-
OK on success.
◆
Add()
[4/7]
Result
<void> Add
|
(
|
typename T
|
|
)
|
|
Adds a job to the group. The group takes
exclusive
ownership of the job. The job will be deleted after it has been executed, when the group will be deleted or when adding the job fails. The job must have been created using
DefaultAllocator
, e.g. with Create() or
NewObj()
. If you had created a job on the stack or used a custom allocator this would lead to a crash. As long as the group is not enqueued you can add jobs from any thread. As soon as it is enqueued only jobs belonging to the group are allowed to add further jobs. THREADSAFE.
-
参数
-
[in]
|
job
|
Job (encapsulated in a
ResultMemT
directly returned from creation).
|
-
返回
-
OK on success.
◆
Add()
[5/7]
Result
<void> Add
|
(
|
typename JOBREF
|
|
)
|
|
Adds a job to the group. The group takes
exclusive
ownership of the job. The job will be deleted after it has been executed, when the group will be deleted or when adding the job fails. The job must have been created using
DefaultAllocator
, e.g. with Create() or
NewObj()
. If you had created a job on the stack or used a custom allocator this would lead to a crash. As long as the group is not enqueued you can add jobs from any thread. As soon as it is enqueued only jobs belonging to the group are allowed to add further jobs. THREADSAFE.
-
参数
-
[in]
|
job
|
Job (encapsulated in a
ResultMemT
directly returned from creation).
|
-
返回
-
OK on success.
◆
Add()
[6/7]
Result
<void> Add
|
(
|
typename T
|
|
)
|
|
Adds an array with multiple jobs of the same type to the group (faster than single
Add()
s). The group takes
exclusive
ownership of the jobs. The jobs and the memory for the array will be freed after they have been executed. If adding the jobs failed they and the memory will be deleted automatically. The array must use the
DefaultAllocator
for memory allocations. Do not use a custom allocator because this would lead to a crash. As long as the group is not enqueued you can add jobs from any thread. As soon as it is enqueued only jobs belonging to the group are allowed to add further jobs. THREADSAFE.
-
参数
-
-
返回
-
OK on success.
◆
Add()
[7/7]
Adds a subgroup to the group. This will add a reference to the group and remove it when the group is not accessed anymore. If adding a subgroup fails its reference will be removed and its jobs will be stopped. As long as the group is not enqueued you can add subgroups from any thread. As soon as it is enqueued only jobs belonging to the group are allowed to add further subgroups. THREADSAFE.
-
参数
-
[in]
|
subGroup
|
Group object (nullptr will return error).
|
-
返回
-
OK on success.