question regarding Display.callSerially()

27 views
Skip to first unread message

Thomas

unread,
Sep 14, 2019, 12:52:59 AM9/14/19
to CodenameOne Discussions
Is there any advantage of splitting a Display.callSerially() task into smaller subtasks or would all the queued serial runnable be executed into the next EDT frame anyway.

For example if I have 

Display.callSerially(()->{A; B; C;});

would
 
Display.callSerially(()->{A;});

Display.callSerially(()->{B;});

Display.callSerially(()->{C;});

potentially be less heavy for the EDT (that could potentially differ the execution of B and C to next frames if A took too long)?


Also, when calling multiple Display.callSerially() can I be sure they would run in their call order (so A then B then C in my second example) or would it be random?

Shai Almog

unread,
Sep 14, 2019, 11:25:11 PM9/14/19
to CodenameOne Discussions
There's no real advantage. Each approach moves the cost differently. If the background thread is long running then split tasks might fit into different EDT "beats" but that would be random.

Calls will remain "in order" when executed though.

Just make sure to minimize the "heavy lifting" on the EDT (e.g. parsing, storage etc.) and everything else should be fine.
Reply all
Reply to author
Forward
0 new messages