OpenCL™规范 5.13.7. 保留和释放信号量

5.13.7. Retaining and Releasing Semaphores
5.13.7. 保留和释放信号量

To release a semaphore object, call the function

要释放信号量对象,请调用函数

// Provided by cl_khr_semaphore
cl_int clReleaseSemaphoreKHR(
    cl_semaphore_khr sema_object);

clReleaseSemaphoreKHR is provided by the cl_khr_semaphore extension.

clReleaseSemaphoreKHR由cl_khr_maphore扩展提供。

  • sema_object specifies the semaphore object to be released.

  • sema_object指定要释放的信号量对象。

The sema_object reference count is decremented.

sema_object引用计数递减。

clReleaseSemaphoreKHR returns CL_SUCCESS if the function is executed successfully. Otherwise, it returns one of the following errors:

如果函数执行成功,clReleaseSemaphoreKHR将返回CL_SUCCESS。否则,它将返回以下错误之一:

  • CL_INVALID_SEMAPHORE_KHR if sema_object is not a valid semaphore object.

  • CL_INVALID_SEMAPHORE_KHR,如果sema_object不是有效的信号量对象。

  • 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实现所需的资源。

After the reference count becomes zero and commands queued for execution on a command-queue(s) that use sema_object have finished, the semaphore object is deleted. Using this function to release a reference that was not obtained by creating the object via clCreateSemaphoreWithPropertiesKHR or by calling clRetainSemaphoreKHR causes undefined behavior.

​在引用计数变为零并且在使用sema_object的命令队列上排队等待执行的命令完成后,信号量对象将被删除。使用此函数释放不是通过clCreateSemaphoreWithPropertiesKHR创建对象或调用clRetainSemaphoreKHR获得的引用会导致未定义的行为。

To retain a semaphore object, call the function

要保留信号量对象,请调用函数

// Provided by cl_khr_semaphore
cl_int clRetainSemaphoreKHR(
    cl_semaphore_khr sema_object);

clRetainSemaphoreKHR is provided by the cl_khr_semaphore extension.

clRetainSemaphoreKHR由cl_khr_maphore扩展提供。

  • sema_object specifies the semaphore object to be retained.

  • sema_object指定要保留的信号量对象。

clRetainSemaphoreKHR increments the reference count of sema_object.

clRetainSemaphoreKHR递增sema_object的引用计数。

clRetainSemaphoreKHR returns CL_SUCCESS if the function is executed successfully. Otherwise, it returns one of the following errors:

如果函数执行成功,clRetainSemaphoreKHR将返回CL_SUCCESS。否则,它将返回以下错误之一:

  • CL_INVALID_SEMAPHORE_KHR if sema_object is not a valid semaphore object.

  • CL_INVALID_SEMAPHORE_KHR,如果sema_object不是有效的信号量对象。

  • 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实现所需的资源。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值