Michael 'Mickey' Lauer wrote:
aye! I got it working in samba yesterday. I had a function that used LOADS of variables and was quite long and complicated and I really didn't want to break it up into composite parts sharing common structures.Sam, this is exciting stuff, I'd love to see this in Vala. Using libpcl I just started it off on another stack, and everytime I had to wait on an async call, I did something like this: req = client_async_req_send(....); req->callback.fn = co_call; req->callback.data = ""> /* yield to main process stack */ co_resume(); status = receive_result(req); Samba has it's own libtevent based message loop, but this code doesn't "know" about that, it just provides a callback address called by Samba's event loop. My team and I are working on the Vala-reimplementation of the freesmartphone.org mobile phone middleware, which makes heavy usage of asynchronous dbus on server side. cool. What phone do you have? I've got an HTC universal but have about given up on it. It's a shame because the size and weight and keyboard and screen and double cameras are perfect. It just needs more RAM, GPS and a newer WLAN to be better than the T1 in every way! And there's even a slot on the board for GPS! AGGGHGHG I also like the LG Versa, although the keyboard layout ought to earn someone a smack, but sadly it seems to run LG-freakos instead of WM or Linux. Well libpcl is nearly as portable as linux pthreads. The only thing I think it needs is the ability to use mmap'd stacks so the RAM is only committed as it is used, then it becomes efficient to over-allocate a stack "in case".One of the two things holding further work back is the lack of dbus error marshalling and server side async dbus support, the latter preferably with coroutines, since it makes parsing the control flow so much better than with dozens of callbacks. Sam With this method, "yield" will switch back to the main context, and should only be called from a co-routine context. Something must generate the co-routine instance. In samba it happens explicitly when the function consciously decides to defer execution of a specific task, but I'm not sure if this carries over well to some vala examples where yield might be used during io selection and so forth.In Python it also happens explicitly -- I don't see a way around this and as far as I'm concerned, I think explicitly is better for clarity. :M: _______________________________________________ Vala-list mailing list Vala-list gnome org http://mail.gnome.org/mailman/listinfo/vala-list |