| 145 | ////////////////////////////////////////////////////////////////// |
| 146 | |
| 147 | cl_int |
| 148 | waitForSuccessfulFinish( |
| 149 | cl_command_queue commandQueues, |
| 150 | cl_event *event) |
| 151 | { |
| 152 | cl_int err, status; |
| 153 | |
| 154 | err = clFinish(commandQueues); |
| 155 | if (err != CL_SUCCESS) { |
| 156 | return err; |
| 157 | } |
| 158 | |
| 159 | if (event == NULL || *event == NULL) { |
| 160 | return CL_SUCCESS; |
| 161 | } |
| 162 | |
| 163 | status = CL_COMPLETE; |
| 164 | err = clGetEventInfo(*event, CL_EVENT_COMMAND_EXECUTION_STATUS, |
| 165 | sizeof(status), &status, NULL); |
| 166 | if (err != CL_SUCCESS) { |
| 167 | return err; |
| 168 | } |
| 169 | if (status < 0) { |
| 170 | return -status; |
| 171 | } |
| 172 | return CL_SUCCESS; |
| 173 | } |
| 174 | |
| 175 | cl_int |
| 176 | flushAll(cl_command_queue commandQueue) |