Guille
unread,Jan 11, 2009, 3:57:27 AM1/11/09Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to slate-language
It sounds interesting. It is more or less how it is implemented right
now, take a look at:
src/ui/gtk/main.slate
src/ui/glib/callbackdata.slate
src/ui/glib/object.slate
and
src/plugins/glib-wrapper.c
When you start gtk a new thread is created for the main loop (see src/
plugins/glib-wrapper.c, wrapper_gtk_lib_init() ).
The message queue is implemented in src/plugins/glib-wrapper.c, it is
called callbackQueue, it uses a GLIB async queue.
Just one callback (to the plugin) is announced to GTK, it manages
every callback. it is implemented in (src/plugins/glib-wrapper.c,
callback() ), all that it does is generate the CallbackData structure
for each signal that arrives and add an entry into the
callbackQueue.
To connect to a signal you do a #when:do: and friends implemented in:
src/ui/glib/object.slate, they register the callback block to execute
into Gtk Main (every connected block is saved in the callbackBlocks
dictionary), and then it connects the blockid, to the gtk framework
using wrapper_g_object_connect_to_block_id (defined at, src/plugins/
glib-wrapper.c).
Slate is freezed waiting for new callbacks in src/ui/gtk/main.slate,
doEventLoop and friends. It tries to get next callbackdata object from
the callbackQueue, if no more data is available it is put to sleep.
When a new callback arrives, it gets the blockid of the callback, and
executes it using the rest of the parameters at the callback structure
(see src/ui/glib/callbackdata.slate), then destroys the callback data,
and lastly waits again.
So if the callback infrastructure is provided by the VM, I would only
have to care about the marshalling of the data.
How do you plan to schedule the callbacks in slate?