public inbox for libffi-discuss@sourceware.org
 help / color / mirror / Atom feed
* Is calling ffi_closure_free within the running of the closures func ok?
@ 2012-10-09  8:30 Simon Feltman
  0 siblings, 0 replies; only message in thread
From: Simon Feltman @ 2012-10-09  8:30 UTC (permalink / raw)
  To: libffi-discuss

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2012-10-09  8:30 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-09  8:30 Is calling ffi_closure_free within the running of the closures func ok? Simon Feltman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).