File: clCreateUserEvent.c

package info (click to toggle)
pocl 6.0-7
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 25,320 kB
  • sloc: lisp: 149,513; ansic: 103,778; cpp: 54,947; python: 1,513; sh: 949; ruby: 255; pascal: 226; tcl: 180; makefile: 175; java: 72; xml: 49
file content (37 lines) | stat: -rw-r--r-- 902 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include "pocl_cl.h"
#include "pocl_util.h"
#include "pocl_timing.h"

CL_API_ENTRY cl_event CL_API_CALL
POname(clCreateUserEvent)(cl_context     context ,
                  cl_int *       errcode_ret ) CL_API_SUFFIX__VERSION_1_1
{
  int errcode;
  cl_event event = NULL;

  POCL_GOTO_ERROR_COND ((!IS_CL_OBJECT_VALID (context)), CL_INVALID_CONTEXT);

  errcode = pocl_create_event (&event, 0, CL_COMMAND_USER, 0, NULL, context);

  if (errcode != CL_SUCCESS)
    {
      POCL_MEM_FREE(event);
    }
  else
    {
      event->pocl_refcount = 1;
      event->status = CL_SUBMITTED;
      event->context = context;
      pocl_user_event_data *p
          = (pocl_user_event_data *)malloc (sizeof (pocl_user_event_data));
      assert (p);
      POCL_INIT_COND (p->wakeup_cond);
      event->data = p;
    }
ERROR:
  if (errcode_ret)
    *errcode_ret = errcode;

  return event;
}
POsym(clCreateUserEvent)