os_workgroup_create_with_workgroup
Create a new workgroup that is bound to the specified workgroup.
Declaration
extern os_workgroup_t os_workgroup_create_with_workgroup(const char *name, os_workgroup_t wg);Parameters
- name:
An optional name for the new workgroup. Use this name to identify the workgroups you create. You may specify
NULLfor this parameter. - wg:
An existing workgroup object.
Return Value
A new workgroup of the same type, and with the same attributes, as the provided workgroup.
Discussion
Use this function to create new references to an existing workgroup in your app. You might create an original workgroup from one thread and create copies of that workgroup for additional threads. The system manages threads from the original workgroup and threads from any copied workgroups as if they belonged to the same group. The use of separate groups avoids the need for multiple threads to coordinate access to a shared data structure.
The new workgroup doesn’t contain any joined threads initially, and it doesn’t contain any context data. This function sets the name of the new workgroup to the value in the name property and configures a reference to the original group in the wg parameter.
You cannot use the returned workgroup object to make configuration changes to the original workgroup. You also cannot call any scheduling functions for the workgroup. For example, attempts to start, stop, or update the deadlines for an interval workgroup return an error when you use the returned workgroup object. Instead, make all configuration and scheduling calls using only the original workgroup object.