File: clSetMemObjectDestructorCallback.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 (26 lines) | stat: -rw-r--r-- 928 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
#include "pocl_cl.h"

CL_API_ENTRY cl_int CL_API_CALL
POname(clSetMemObjectDestructorCallback)(  cl_mem  memobj , 
                                    void (CL_CALLBACK * pfn_notify)( cl_mem /* memobj */, void* /*user_data*/), 
                                    void * user_data  )             CL_API_SUFFIX__VERSION_1_1
{
  mem_destructor_callback_t *callback;

  POCL_RETURN_ERROR_COND ((!IS_CL_OBJECT_VALID (memobj)),
                          CL_INVALID_MEM_OBJECT);
  POCL_RETURN_ERROR_COND((pfn_notify == NULL), CL_INVALID_VALUE);

  callback = (mem_destructor_callback_t *)malloc (
      sizeof (mem_destructor_callback_t));
  if (callback == NULL)
    return CL_OUT_OF_HOST_MEMORY;

  callback->pfn_notify = pfn_notify;
  callback->user_data  = user_data;
  callback->next       = memobj->destructor_callbacks;
  memobj->destructor_callbacks = callback;

  return CL_SUCCESS;
}
POsym(clSetMemObjectDestructorCallback)