EasyThread Bug?

30 views
Skip to first unread message

remon...@ordyx.com

unread,
Nov 4, 2018, 10:33:31 PM11/4/18
to CodenameOne Discussions
I think EasyThread has a bug where a Runnable is never executed. 

Here is the simplest code to reproduce the problem. Add the following code in the start() method of the app:

        EasyThread et1 = EasyThread.start("et1");
        
        et1.run(()->java.lang.System.out.println("************ EASYTHREAD1"));

        EasyThread et2 = EasyThread.start("et2");
        
        et2.run(()->java.lang.System.out.println("************ EASYTHREAD2"));

In the simulator in my case it only shows the following in the log:

************ EASYTHREAD1

The second one never shows. This could be different on different machines and you might need to add more threads for this to show however on my computer it always produces the same result.

Looking at the source for EasyThread the first thing I noticed was that "LOCK" is a static final. Why would lock be static? Why would each instance of EasyThread share the same LOCK?

However I don't think "LOCK" being static is what causes the issue.

Please let me know what is the issue and how it can be fixed.

Shai Almog

unread,
Nov 5, 2018, 12:08:10 AM11/5/18
to CodenameOne Discussions
That makes sens, we'll remove the static modifier for the next update.

remon...@ordyx.com

unread,
Nov 5, 2018, 8:44:26 AM11/5/18
to CodenameOne Discussions
Thank you for your response.

Do you think this static is the whole issue?

Shai Almog

unread,
Nov 6, 2018, 12:11:27 AM11/6/18
to CodenameOne Discussions
It sounds like it. That's exactly the type of problem that would happen.

remon...@ordyx.com

unread,
Jan 3, 2019, 2:27:17 PM1/3/19
to CodenameOne Discussions
Do you have an ETA on this fix?

Shai Almog

unread,
Jan 3, 2019, 10:37:29 PM1/3/19
to CodenameOne Discussions
This was fixed ages ago. I just tried the test case on the simulator and it worked for me.

remon...@ordyx.com

unread,
Jan 4, 2019, 10:03:39 AM1/4/19
to CodenameOne Discussions
Since I didn't see a comment from you here saying that is was fixed I assumed it was not.

Thank you.

Shai Almog

unread,
Jan 5, 2019, 12:12:46 AM1/5/19
to CodenameOne Discussions
For future reference when I say next update I usually mean Friday. I should have explicitly specified it.
Reply all
Reply to author
Forward
0 new messages