This is the mail archive of the libffi-discuss@sourceware.org mailing list for the libffi project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Is calling ffi_closure_free within the running of the closures func ok?


Hi Everyone,

Some context: with pygobject/gobject-introspection/glib, there is the
ability to create a python callback wrapped by an ffi_closure. The
closure can be added to a glib event queue and run asynchronously at
any time. These are single shot callbacks and the simplest technique
to free their resources (python callable and ffi_closure) is to put
the cleanup code at the end of the ffi_closures function. A static
cleanup callback could be added to the event queue instead, but in
this case there is no gaurentee an event loop is even running due to
this being setup through generic marshaling of a python callable to a
C function pointer as an argument to a C function.

Is calling ffi_closure_free within the running of the closures held
function ok? It works fine in my tests but I want to make sure this is
a supported technique.

Thanks,
-Simon


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]