5.13.8. Semaphore Queries
5.13.8. 信号量查询
To query information about a semaphore object, call the function
要查询信号量对象的信息,请调用函数
// Provided by cl_khr_semaphore
cl_int clGetSemaphoreInfoKHR(
cl_semaphore_khr sema_object,
cl_semaphore_info_khr param_name,
size_t param_value_size,
void* param_value,
size_t* param_value_size_ret);
| clGetSemaphoreInfoKHR is provided by the clGetSemaphoreInfoKHR由cl_khr_maphore扩展提供。 |
-
sema_object specifies the semaphore object being queried.
-
sema_object指定要查询的信号量对象。
-
param_name is a constant that specifies the semaphore information to query, and must be one of the values shown in the Semaphore Queries table.
-
param_name是一个常数,指定要查询的信号量信息,并且必须是信号量查询表中显示的值之一。
-
param_value is a pointer to memory where the result of the query is returned as described in the Semaphore Queries table. If param_value is
NULL, it is ignored. -
param_value是一个指向内存的指针,在内存中返回查询结果,如Semaphore Queries表所述。如果param_value为NULL,则忽略它。
-
param_value_size specifies the size in bytes of memory pointed to by param_value. This size must be greater than or equal to the size of the return type specified in the Semaphore Queries table. If param_value is
NULL, it is ignored. -
param_value_size指定param_value指向的内存大小(以字节为单位)。此大小必须大于或等于信号量查询表中指定的返回类型的大小。如果param_value为NULL,则忽略它。
-
param_value_size_ret returns the actual size in bytes of data being queried by param_value. If param_value_size_ret is
NULL, it is ignored. -
param_value_size_ret返回param_value查询的数据的实际大小(以字节为单位)。如果param_value_size_ret为NULL,则忽略它。
| Semaphore Info 信号量信息 | Return Type 返回类型 | Description 描述 |
|---|---|---|
|
| Returns the context specified when the semaphore is created. 返回创建信号量时指定的上下文。 | |
|
| Returns the semaphore reference count. 返回信号量引用计数。 | |
|
| Return the properties argument specified in clCreateSemaphoreWithPropertiesKHR. The implementation must return the values specified in the properties argument in the same order and without including additional properties. 实现必须以相同的顺序返回properties参数中指定的值,并且不包括其他属性。 | |
|
| Returns the semaphore type. 返回信号量类型。 | |
|
| Returns the semaphore payload value. For semaphores of type CL_SEMAPHORE_TYPE_BINARY_KHR the payload value returned will be 返回信号量有效载荷值。对于CL_SEMAPHORE_TYPE_BINARY_KHR类型的信号量,如果信号量处于未信号状态,则返回的有效载荷值将为0,如果处于信号状态,返回的有效负载值将为1。 | |
|
| Returns the list of OpenCL devices the semaphore is associated with. 返回与信号量关联的OpenCL设备列表。 | |
|
| Returns the list of external semaphore handle types that may be used for exporting. The size of this query may be 0 indicating that this semaphore does not support any handle types for exporting. 返回可用于导出的外部信号量句柄类型列表。此查询的大小可能为0,表示此信号量不支持任何用于导出的句柄类型。 | |
|
| Returns CL_TRUE if the semaphore is exportable and CL_FALSE otherwise. 如果信号量可导出,则返回CL_TRUE,否则返回CL_FALSE。 |
clGetSemaphoreInfoKHR returns CL_SUCCESS if the information is queried successfully. Otherwise, it returns one of the following errors:
如果信息查询成功,clGetSemaphoreInfoKHR将返回CL_SUCCESS。否则,它将返回以下错误之一:
-
CL_INVALID_SEMAPHORE_KHR if sema_object is not a valid semaphore.
-
CL_INVALID_SEMAPHORE_KHR,如果sema_object不是有效的信号量。
-
CL_INVALID_VALUE if param_name is not one of the supported values, or if the size in bytes specified by param_value_size is less than size of the return type specified in the Semaphore Queries table and param_value is not
NULL. -
如果param_name不是支持的值之一,或者param_value_size指定的字节大小小于Semaphore Queries表中指定的返回类型的大小,并且param_value不为NULL,则返回CL_INVALID_VALUE。
-
CL_OUT_OF_RESOURCES if there is a failure to allocate resources required by the OpenCL implementation on the device.
-
CL_OUT_OF_RESOURCES,如果无法在设备上分配OpenCL实现所需的资源。
-
CL_OUT_OF_HOST_MEMORY if there is a failure to allocate resources required by the OpenCL implementation on the host.
-
CL_OUT_OF_HOST_MEMORY,如果无法在主机上分配OpenCL实现所需的资源。




被折叠的 条评论
为什么被折叠?



