C Specification

To re-import a handle of type CL_SEMAPHORE_HANDLE_SYNC_FD_KHR into an existing semaphore, call the function:

// Provided by cl_khr_external_semaphore_sync_fd
cl_int clReImportSemaphoreSyncFdKHR(
    cl_semaphore_khr sema_object,
    cl_semaphore_reimport_properties_khr* reimport_props,
    int fd);

Parameters

  • sema_object specifies a valid semaphore object with importable properties.

  • reimport_props is an optional list of properties that affect the re-import behavior. The list is terminated with the special property 0. If no properties are required, reimport_props may be NULL. This extension does not define any optional properties.

  • fd specifies an external file descriptor handle to import

Description

Calling clReImportSemaphoreSyncFdKHR is equivalent to destroying sema_object and re-creating it with the original sema_props from clCreateSemaphoreWithPropertiesKHR, except a handle specified by fd will be imported. The semaphore sema_object must have originally imported an external handle of type CL_SEMAPHORE_HANDLE_SYNC_FD_KHR.

clReImportSemaphoreSyncFdKHR returns CL_SUCCESS if the semaphore handle is re-imported successfully. Otherwise, it returns one of the following errors:

  • CL_INVALID_SEMAPHORE_KHR

    • if sema_object is not a valid semaphore

  • CL_INVALID_SEMAPHORE_KHR if a CL_SEMAPHORE_HANDLE_SYNC_FD_KHR handle was not imported when sema_object was created.

  • CL_INVALID_VALUE if fd is invalid.

  • CL_OUT_OF_HOST_MEMORY if there is a failure to allocate resources required by the OpenCL implementation on the host.

  • CL_OUT_OF_RESOURCES if there is a failure to allocate resources required by the OpenCL implementation on the device.

See Also

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.

Copyright 2014-2025 The Khronos Group Inc.

SPDX-License-Identifier: CC-BY-4.0