---
name: "clSetUserEventStatus"
section: "3clc"
platform: "linux"
package: "opencl-1.2-man-doc"
version: "1.0~svn33624-5.1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/clSetUserEventStatus"
---

# clSetUserEventStatus(3clc)

Sets the execution status of a user event object.

## NAME

clSetUserEventStatus - Sets the execution status of a user event object.

##

**cl\_int clSetUserEventStatus(cl\_event** *event***, cl\_int** *execution\_status***);**

## PARAMETERS

*event*

A user event object created using [**clCreateUserEvent**(3clc)](/clCreateUserEvent/3clc.md).

*execution\_status*

Specifies the new execution status to be set and can be **CL\_COMPLETE** or a negative integer value to indicate an error. A negative integer value causes all enqueued commands that wait on this user event to be terminated. **clSetUserEventStatus** can only be called once to change the execution status of *event*.

## NOTES

Enqueued commands that specify user events in the *event\_wait\_list* argument of **clEnqueue\*\*\*** commands must ensure that the status of these user events being waited on are set using **clSetUserEventStatus** before any OpenCL APIs that release OpenCL objects except for event objects are called; otherwise the behavior is undefined.

## ERRORS

Returns CL\_SUCCESS if the function was executed successfully. Otherwise, it returns one of the following errors

• CL\_INVALID\_EVENT if *event* is not a valid user event.

• CL\_INVALID\_VALUE if the *execution\_status* is not **CL\_COMPLETE** or a negative integer value.

• CL\_INVALID\_OPERATION if the *execution\_status* for *event* has already been changed by a previous call to **clSetUserEventStatus**.

• CL\_OUT\_OF\_RESOURCES if there is a failure to allocate resources required by the OpenCL implementation on the device.

• CL\_OUT\_OF\_HOST\_MEMORY if there is a failure to allocate resources required by the OpenCL implementation on the host.

### Example

For example, the following code sequence will result in undefined behavior of [**clReleaseMemObject**(3clc)](/clReleaseMemObject/3clc.md).

| |
| --- |
| ev1 = clCreateUserEvent(ctx, NULL); clEnqueueWriteBuffer(cq, buf1, CL\_FALSE, ..., 1, &ev1, NULL; clEnqueueWriteBuffer(cq, buf2, CL\_FALSE,...); clReleaseMemObject(buf2); clSetUserEventStatus(ev1, CL\_COMPLETE); |

The following code sequence, however, works correctly.

| |
| --- |
| ev1 = clCreateUserEvent(ctx, NULL); clEnqueueWriteBuffer(cq, buf1, CL\_FALSE, ..., 1, &ev1, NULL; clEnqueueWriteBuffer(cq, buf2, CL\_FALSE,...); clSetUserEventStatus(ev1, CL\_COMPLETE); clReleaseMemObject(buf2); |

## SPECIFICATION

**OpenCL Specification**\[1\]

## SEE ALSO

[**clCreateUserEvent**(3clc)](/clCreateUserEvent/3clc.md)

## AUTHORS

**The Khronos Group**

## COPYRIGHT

Copyright © 2007-2011 The Khronos Group Inc.\
 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and/or associated documentation files (the "Materials"), to deal in the Materials without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Materials, and to permit persons to whom the Materials are furnished to do so, subject to the condition that this copyright notice and permission notice shall be included in all copies or substantial portions of the Materials.

## NOTES

- 1\.

  OpenCL Specification

  page 178, section 5.9 - Event Objects
