C Specification
To create a semaphore object, call the function
// Provided by cl_khr_semaphore
cl_semaphore_khr clCreateSemaphoreWithPropertiesKHR(
cl_context context,
const cl_semaphore_properties_khr* sema_props,
cl_int* errcode_ret);
clCreateSemaphoreWithPropertiesKHR is provided by the cl_khr_semaphore extension.
|
Parameters
-
context identifies a valid OpenCL context that the created
cl_semaphore_will belong to.khr -
sema_props specifies additional semaphore properties in the form list of <property_name, property_value> pairs terminated with 0.
CL_SEMAPHORE_must be part of the list of properties specified by sema_props.TYPE_ KHR
Description
Following new properties are added to the list of possible supported
properties by cl_semaphore_ that can be passed to
clCreateSemaphoreWithPropertiesKHR:
| Semaphore Property | Property Value | Description |
|---|---|---|
|
|
Specifies the type of semaphore to create. This property is always required. |
|
|
Specifies the list of OpenCL devices (terminated with
|
provided by the |
|
Specifies the list of semaphore handle type properties (terminated
with |
If CL_SEMAPHORE_ is not specified as part of
sema_props, the semaphore object created by
clCreateSemaphoreWithPropertiesKHR is by default associated with all devices
in the context.
For a multi-device context CL_SEMAPHORE_ must be
specified in sema_props.
The properties used to create a semaphore from an external semaphore handle are described for the corresponding extensions.
errcode_ret returns an appropriate error code.
If errcode_ret is NULL, no error code is returned.
clCreateSemaphoreWithPropertiesKHR returns a valid semaphore object in an
un-signaled state and errcode_ret is set to CL_SUCCESS if the
function is executed successfully.
Otherwise, it returns a NULL value with one of the following error values
returned in errcode_ret:
-
CL_INVALID_if context is not a valid context.CONTEXT -
CL_INVALID_if a property name in sema_props is not a supported property name, if the value specified for a supported property name is not valid, or if the same property name is specified more than once. Additionally, if context is a multiple device context and sema_props does not specifyPROPERTY CL_SEMAPHORE_.DEVICE_ HANDLE_ LIST_ KHR -
CL_INVALID_ifDEVICE CL_SEMAPHORE_is specified as part of sema_props, but it does not identify exactly one valid device; or if a device identified byDEVICE_ HANDLE_ LIST_ KHR CL_SEMAPHORE_is not one of the devices within context.DEVICE_ HANDLE_ LIST_ KHR -
CL_INVALID_VALUE -
if sema_props is
NULL, or -
if sema_props do not specify <property, value> pairs for minimum set of properties (i.e.
CL_SEMAPHORE_) required for successful creation of aTYPE_ KHR cl_semaphore_, orkhr
-
-
CL_OUT_if there is a failure to allocate resources required by the OpenCL implementation on the device.OF_ RESOURCES -
CL_OUT_if there is a failure to allocate resources required by the OpenCL implementation on the host.OF_ HOST_ MEMORY -
CL_INVALID_if one or more devices identified by propertiesDEVICE CL_SEMAPHORE_cannot import the requested external semaphore handle type.DEVICE_ HANDLE_ LIST_ KHR -
CL_INVALID_if more than one semaphore handle type is specified in theVALUE CL_SEMAPHORE_list.EXPORT_ HANDLE_ TYPES_ KHR -
CL_INVALID_If props_list specifies aOPERATION cl_external_followed by a handle as well assemaphore_ handle_ type_ khr CL_SEMAPHORE_. Exporting a semaphore handle from a semaphore that was created by importing an external semaphore handle is not permitted.EXPORT_ HANDLE_ TYPES_ KHR -
CL_INVALID_if sema_props includes more than one external semaphore handle.PROPERTY
Document Notes
For more information, see the OpenCL Specification
This page is extracted from the OpenCL Specification. Fixes and changes should be made to the Specification, not directly.