Concurrency in flow question

Post your questions and help other users.

Moderator: Martin

Post Reply
User avatar
jassing
Posts: 94
Joined: 16 Jul 2017 01:42
Location: SF Bay Area

Concurrency in flow question

Post by jassing » 10 Nov 2019 22:17

I have a question about concurrency in flows.

It seems to work, almost, as I expected...
This Flow
Image
It waits for both threads... Then continues, but continues twice. Shouldn't it just wait and then resume as a single thread?

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: Concurrency in flow question

Post by Martin » 12 Nov 2019 19:55

Hi,

The image can not be loaded for me. Could you please share the flow or upload the image again?

Regards,
Martin

User avatar
jassing
Posts: 94
Joined: 16 Jul 2017 01:42
Location: SF Bay Area

Re: Concurrency in flow question

Post by jassing » 24 Nov 2019 03:42

Attached.

Thank you.
Attachments
concurrencyTest.7z
(921 Bytes) Downloaded 663 times

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: Concurrency in flow question

Post by Desmanto » 24 Nov 2019 07:56

It is working already as expected. If you rejoin the flow after you split it, the flow now have 2 "threads" running. If you want only single, you must disconnect one of them. Or you can rejoin both thread by using condition execution count, set to 2.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

User avatar
jassing
Posts: 94
Joined: 16 Jul 2017 01:42
Location: SF Bay Area

Re: Concurrency in flow question

Post by jassing » 24 Nov 2019 08:40

Thanks. I mistook the fact that it Waits for both threads to complete before moving on to mean the threads rejoined to one. What is interesting is it doesn't always result in everything being run multiple times...
using condition execution count, set to 2.
Thank you. I'll have look for that. Discover new things all the time...

Cheers,
-josh

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: Concurrency in flow question

Post by Desmanto » 24 Nov 2019 09:13

The parallel threading there cause the other part of the thread to wait. It is useful in some cases, where you input dialog to stay or do something there. But we usually use parallel design when combined with condition, as I pointed out in mutliple parallel expression; which allow you to combine multiple one=trick pony flows to a single flow with many triggers. viewtopic.php?f=5&t=6882
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

User avatar
jassing
Posts: 94
Joined: 16 Jul 2017 01:42
Location: SF Bay Area

Re: Concurrency in flow question

Post by jassing » 25 Nov 2019 05:24

I get it... But, it's curious how sometimes it continues as two threads, but other times it results in a single thread again...

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: Concurrency in flow question

Post by Desmanto » 25 Nov 2019 17:07

At mine, it is mostly two threads. But maybe I haven't tried it long enough to encounter the single thread result. Maybe this is related with your other thread question. I will continue there instead.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

Post Reply