diff options
-rw-r--r-- | src/com/mbien/opencl/CLEvent.java | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/src/com/mbien/opencl/CLEvent.java b/src/com/mbien/opencl/CLEvent.java index 1855fea9..5d244190 100644 --- a/src/com/mbien/opencl/CLEvent.java +++ b/src/com/mbien/opencl/CLEvent.java @@ -37,9 +37,15 @@ public class CLEvent implements CLResource { checkForError(ret, "can not release event"); } + /** + * Returns the execution status of the command which triggers this event. + */ public ExecutionStatus getStatus() { - int status = (int)eventInfo.getLong(CL_EVENT_COMMAND_EXECUTION_STATUS); - return ExecutionStatus.valueOf(status); + return ExecutionStatus.valueOf(getStatusCode()); + } + + public int getStatusCode() { + return (int)eventInfo.getLong(CL_EVENT_COMMAND_EXECUTION_STATUS); } public CommandType getType() { @@ -182,7 +188,12 @@ public class CLEvent implements CLResource { /** * The command has completed. */ - COMPLETE(CL_COMPLETE); + COMPLETE(CL_COMPLETE), + + /** + * The command did not complete because of an error. + */ + ERROR(-1); /** @@ -205,6 +216,9 @@ public class CLEvent implements CLResource { case(CL_COMPLETE): return COMPLETE; } + if(status < 0) { + return ERROR; + } return null; } } |