Page 11 of 11

Re: issue-#156 adding Coroutines to BlackBox

PostPosted: Tue Apr 16, 2019 6:36 pm
by Robert
Josef Templ wrote:And it only happens when you unload the suspended coroutine's module, right?

My normal workflow is:
- Edit
- Ctrl k - Compile
- Ctrl s - Save if no compile errors.
- Unload
- Try new version
& repeat many times ....

The crashes usually occur during the Compile.

Re: issue-#156 adding Coroutines to BlackBox

PostPosted: Tue Apr 16, 2019 6:37 pm
by Robert
Josef Templ wrote:What about stopping the coroutine(s) before unloading the module?

Not exactly sure what you are suggesting - I think you mean adding something to the CLOSE section of my module?

Re: issue-#156 adding Coroutines to BlackBox

PostPosted: Tue Apr 16, 2019 6:38 pm
by Josef Templ
What you could also try is to unload all modules that use Coroutines and in addition to unload the module Coroutines themselves.
This terminates Coroutine support and may lead to a more stable behavior with respect to GC.

- Josef

Re: issue-#156 adding Coroutines to BlackBox

PostPosted: Thu Apr 18, 2019 11:54 am
by Robert
In the last couple of days the main activity of my Coroutines module has changed from being 90% development / 10% use to 10% development / 90% use. I am getting far fewer crashes - 1 two days ago.

I have now added Coroutines.Cleanup to my CLOSE section. I don't really understand what it does. The Docu says "sets main.from = NIL". Is that correct?

Re: issue-#156 adding Coroutines to BlackBox

PostPosted: Thu Apr 18, 2019 1:55 pm
by Robert
And now I got another (small window) TRAP: "illegal memory write [ad = 0000008]" called from Coroutines.Cleanup.

Re: issue-#156 adding Coroutines to BlackBox

PostPosted: Thu Apr 18, 2019 8:04 pm
by Josef Templ
Robert wrote:And now I got another (small window) TRAP: "illegal memory write [ad = 0000008]" called from Coroutines.Cleanup.


This one can be explained, I think.
Coroutines.Cleanup assumes that coroutines have been started and then main is not NIL. IF main is NIL you get what you have observed.
The fix in Coroutines.Cleanup is simple. It can also be done from the outside, of course.

Code: Select all
   PROCEDURE Cleanup*;
   BEGIN
      IF main # NIL THEN main.source := NIL END
   END Cleanup;


- Josef