Multiple threads running ok in debug but not with exe

18 views
Skip to first unread message

jjj...@gmail.com

unread,
May 4, 2026, 8:09:43 AM (2 days ago) May 4
to Migrated By Firefly
Hello,

I'm trying to run multiple threads and followed the manual from https://doc.fireflymigration.com/using-threads-to-improve-performance-of-business-process.html. This is working in debug mode, but if I try to start it from the exe it looks like the started threads keep on running. 

Has anyone else seen this problem and/or knows how to solve it ?

Best regards,

Jeroen Bos
Lekkerland Nederland BV

jjj...@gmail.com

unread,
May 5, 2026, 3:16:48 AM (yesterday) May 5
to Migrated By Firefly
I've found the cause of the problem. To run the threads correctly I already added a variable to the ApplicationCore, OnLoad and OnStart to indicate that they had already been executed. However we also have some logic in the OnEnd of the  ApplicationCore that shouldn't execute in the started threads. So Now I have to figure out something so that the OnEnd of the ApplicationCore will only execute when the Main thread is closed.

Op maandag 4 mei 2026 om 14:09:43 UTC+2 schreef jjj...@gmail.com:

Noam Honig

unread,
May 5, 2026, 8:16:19 AM (yesterday) May 5
to jjj...@gmail.com, Migrated By Firefly
There's  a method in common called IsMainContext - make it public and use it

Noam Honig  
Founder & CEO


--
You received this message because you are subscribed to the Google Groups "Migrated By Firefly" group.
To unsubscribe from this group and stop receiving emails from it, send an email to migrated-by-fir...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/migrated-by-firefly/96379b07-ddff-4a3f-ba6f-48fa3bb04ea9n%40googlegroups.com.

jjj...@gmail.com

unread,
May 5, 2026, 9:50:05 AM (yesterday) May 5
to Migrated By Firefly
Hi Noam,

Thank you for your answer, I've solved it another way:

1. I defined a global numeric variable "Glb_Main_Thread_ID.Value"
2. In the OnStart, in the part that will only be executed once, of the ApplicationCore, I initialize this variable with System.Threading.Thread.CurrentThread.ManagedThreadId.
3. In the OnEnd the code will only be executed if "Glb_Main_Thread_ID.Value" > 0

Op dinsdag 5 mei 2026 om 14:16:19 UTC+2 schreef no...@fireflymigration.com:

Lawrence Fisher

unread,
May 5, 2026, 10:48:23 AM (yesterday) May 5
to jjj...@gmail.com, Migrated By Firefly
Probably what IsMainContext does as well

Sent from my iPhone

Lawrence

On 5 May 2026, at 16:50, jjj...@gmail.com <jjj...@gmail.com> wrote:

Hi Noam,
Reply all
Reply to author
Forward
0 new messages