Hi John,

> To be sure, for debugging you create a coroutine then run the whole
> app in that coroutine state using debug hooks and yields to pause it?

This is exactly correct. Debug hook is registered to that coroutine,
but the debugger itself runs in yet another coroutine.

> What happens when a wxLua app is paused at a breakpoint and an event
> handler is called? Don't you get an error saying something about
> resuming a suspended coroutine or is the coroutine not yielded to
> pause the execution?

No; never got this message. The application itself is suspended, so it
can't really receive any messages. In fact, I actually *do* set event
handlers from the debug coroutine while it's suspended to minimize
"busyness" of the application (it's around lines 540-550 in
mobdebug.lua), but I have never seen any crashes related to that.

> I would also like to understand what the advantages of the coroutine
> method of debugging are over the wxLua blocking socket method?

I don't use wxlua sockets because the debugger uses exactly the same
mechanism running wxlua or any other lua application.

> In any case, normally anyone who tries to connect an event handler in
> a coroutine will crash their program in a very hard to debug way,
> especially if the coroutine they installed the callback in gets
> garbage collected.

It seems like this has been working fine for me for as long as the
code that handles the callback is in the same coroutine as the code
that sets it (which is my case).

What I also do to support live coding is to call "error" from the
debug hook in the main coroutine, which allows me to reload the code
while the application is running. This is when it crashes with the
current wxlua code and doesn't crash with the patch. It seems like the
line I commented out in the patch does something to the Lua state that
causes the crash.

> I would like to find a way to have it work for your case, but also not
> frustrate new wxLua users who might imagine that they can somehow
> create a "threaded" GUI app using coroutines, not understanding that
> events are already sent asynchronously as has happened in the past.
>
> Maybe it is enough to simply have a strongly worded comment in the
> documentation, but please explain a little about your debugging
> methods.

"A strongly worded comment" would definitely make sense. Please let me
know if you'd need any additional details or a small example that
demonstrates the issue.

Paul.

On Wed, Feb 27, 2013 at 9:39 PM, John Labenski <jlaben...@gmail.com> wrote:
> On Wed, Feb 27, 2013 at 6:26 PM, Paul K <paulclin...@yahoo.com> wrote:
>> Hi John,
>>
>> I'd like to resurrect this discussion as the issue hasn't been fully
>> put to bed and as I'm preparing for 2.9 wxwidgets upgrade I'd like to
>> figure out whether I still need to patch wxlua to support my use case.
>
>> I ended up patching wxlua and removing that one line that was added in
>> the revision 104 (line 103 in this diff:
>> http://wxlua.svn.sourceforge.net/viewvc/wxlua/trunk/wxLua/modules/wxlua/src/wxlcallb.cpp?r1=100&r2=104&pathrev=104).
>
> To be sure, for debugging you create a coroutine then run the whole
> app in that coroutine state using debug hooks and yields to pause it?
> What happens when a wxLua app is paused at a breakpoint and an event
> handler is called? Don't you get an error saying something about
> resuming a suspended coroutine or is the coroutine not yielded to
> pause the execution?
>
> I would also like to understand what the advantages of the coroutine
> method of debugging are over the wxLua blocking socket method?
>
> In any case, normally anyone who tries to connect an event handler in
> a coroutine will crash their program in a very hard to debug way,
> especially if the coroutine they installed the callback in gets
> garbage collected.
>
> I would like to find a way to have it work for your case, but also not
> frustrate new wxLua users who might imagine that they can somehow
> create a "threaded" GUI app using coroutines, not understanding that
> events are already sent asynchronously as has happened in the past.
>
> Maybe it is enough to simply have a strongly worded comment in the
> documentation, but please explain a little about your debugging
> methods.
>
> Regards,
>     John
>
> ------------------------------------------------------------------------------
> Everyone hates slow websites. So do we.
> Make your web apps faster with AppDynamics
> Download AppDynamics Lite for free today:
> http://p.sf.net/sfu/appdyn_d2d_feb
> _______________________________________________
> wxlua-users mailing list
> wxlua-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wxlua-users

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb
_______________________________________________
wxlua-users mailing list
wxlua-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wxlua-users

Reply via email to