Re: [Vala] Need help in debugging async code

2016-09-27 Thread Michele Dionisio
I'm sorry the url is: https://bugzilla.gnome.org/show_bug.cgi?id=772084 2016-09-27 22:38 GMT+02:00 Michele Dionisio : > I think that now the patch is ok. I have add a bug for that on gnome bugzilla: > https://bugzilla.gnome.org/show_bug.cgi?id=772084 > > regards > >

Re: [Vala] Need help in debugging async code

2016-09-27 Thread Michele Dionisio
I think that now the patch is ok. I have add a bug for that on gnome bugzilla: https://bugzilla.gnome.org/show_bug.cgi?id=772084 regards 2016-09-24 10:33 GMT+02:00 Nor Jaidi Tuah : > >> now, >> >> _state_in_progress_ is assigned to -1 at beginning >> the check if >> >>

Re: [Vala] Need help in debugging async code

2016-09-24 Thread Michele Dionisio
many thanks for your test and feedback. Now I'will spend more than 2 minutes to make the fix, spending more time understanding and testing. I have undestand exactly way the patch if not working, and everything came from from my mistake undestanding how vala works. for example. When you call

Re: [Vala] Need help in debugging async code

2016-09-24 Thread Nor Jaidi Tuah
> now, > > _state_in_progress_ is assigned to -1 at beginning > the check if > > _state_in_progress_ == _state_ is move before the switch to work in > any state. >  That won't work either. The fundamental problem is that the caller that calls the callback (the mainloop or whatever alternative

Re: [Vala] Need help in debugging async code

2016-09-24 Thread Michele Dionisio
absolutly not tested my last patch attached that teorically solve all the issue: now, _state_in_progress_ is assigned to -1 at beginning the check if _state_in_progress_ == _state_ is move before the switch to work in any state. Do you think that is good now? 2016-09-24 5:46 GMT+02:00 Nor

Re: [Vala] Need help in debugging async code

2016-09-24 Thread michele . dionisio
Yes state 0 is not safe yet. I have to find -state-in-progress and implement the same check. What do you thinl. It is a good odea to continue to work on it or it is useless? Il sab set 24 05:46:34 2016 GMT+0200, Nor Jaidi Tuah scrive: > If I understand your patch correctly, it would generate >

Re: [Vala] Need help in debugging async code

2016-09-23 Thread Nor Jaidi Tuah
If I understand your patch correctly, it would generate something like this: if (_data_->_state_ != 1) { _data_->_state = 1; return FALSE; } else { // callback already called } etc. etc. I don't think that's going to work with your use case. _data_->_state_

Re: [Vala] Need help in debugging async code

2016-09-22 Thread michele . dionisio
Vala implement async like in http://www.chiark.greenend.org.uk/~sgtatham/coroutines.html To avoid the limitation of stack usage (and to implement clousure) vala use the heap. Also the state is in the heap. I have only add a check to check if a specific state is already executed. There is no

Re: [Vala] Need help in debugging async code

2016-09-22 Thread Nor Jaidi Tuah
> Idle.add(myfunc.callback) is not good for 2 reason: > 1. performance. you go back to the mainloop > 2. Idle.add has to have less priority that the function that you have > to wakeup. >  Is the mainloop dispatch performance really inefficient? Just wondering here because I honestly do not know.

Re: [Vala] Need help in debugging async code

2016-09-22 Thread Michele Dionisio
Hi all. I have implemented a patch for vala for safe manage situation like the one describe on this discution. The solution to call Idle.add(myfunc.callback) is not good for 2 reason: 1. performance. you go back to the mainloop 2. Idle.add has to have less priority that the function that you have

Re: [Vala] Need help in debugging async code

2016-03-20 Thread mar...@saepia.net
Felipe, SIGSTOP is real signal issued by the OS that has stopped the execution. Michele, it seems you were right. I've changed all callback() calls to Idle.add(myfunc.callback) so I am 100% sure that they are async and crashes stopped to occur. I must admit that it was one of the weirdest bugs

Re: [Vala] Need help in debugging async code

2016-03-19 Thread Felipe Lavratti
Hey Marcin, Just wondering, Is your program using threading or any threaded object that is handled in this part of code? On Thu, Mar 17, 2016 at 20:44 mar...@saepia.net wrote: > Hi all, > > I encounter random crashes in my app, which (it's my guess) is triggered > when I

Re: [Vala] Need help in debugging async code

2016-03-19 Thread Felipe Lavratti
Hey, Why did you get a SIGSTOP on top of the stack trace? Is it emitted from the code you use to print the stacktrace or it is the real signal that stopped execution? On Fri, Mar 18, 2016 at 6:22 AM mar...@saepia.net wrote: > Felipe, it's non threaded. > > Michele, good hint!

Re: [Vala] Need help in debugging async code

2016-03-19 Thread michele . dionisio
A crash can happes if you call the callback to wakeup before the yield. Are you completly sure that your code is completly asyncrounous in any condition. Il ven mar 18 01:05:05 2016 GMT+0100, Felipe Lavratti scrive: > Hey Marcin, > > Just wondering, > Is your program using threading or any

Re: [Vala] Need help in debugging async code

2016-03-18 Thread mar...@saepia.net
Felipe, it's non threaded. Michele, good hint! I will check that. m. 2016-03-18 6:47 GMT+01:00 : > A crash can happes if you call the callback to wakeup before the yield. > Are you completly sure that your code is completly asyncrounous in any > condition. > > Il