Method: OpenCL.set_program_release_callback
- Defined in:
- lib/opencl_ruby_ffi/Program.rb
.set_program_release_callback(program, options = {}, &block) ⇒ Object
Attaches a callback to program that will be called on program release
Attributes
-
program- the Program to attach the callback to -
options- a hash containing named options -
block- if provided, a callback invoked when program is released. Signature of the callback is { |Pointer to the program, Pointer to user_data| … }
Options
-
:user_data- a Pointer (or convertible to Pointer using to_ptr) to the memory area to pass to the callback
241 242 243 244 245 246 247 248 249 250 251 252 253 254 |
# File 'lib/opencl_ruby_ffi/Program.rb', line 241 def self.set_program_release_callback( program, = {}, &block ) if block wrapper_block = lambda { |p, u| block.call(p, u) @@callbacks.delete(wrapper_block) } @@callbacks[wrapper_block] = [:user_data] else wrapper_block = nil end error = clSetProgramReleaseCallback( program, wrapper_block, [:user_data] ) error_check(error) return program end |