11-24-2024, 10:46 PM
If i have a program and call a subroutine in that program from the UI thread, will it still be on the UI thread or does it run on a different thread?
JR
JR
Threads
|
11-24-2024, 10:46 PM
If i have a program and call a subroutine in that program from the UI thread, will it still be on the UI thread or does it run on a different thread?
JR
Small Basic Threading : https://learn.microsoft.com/en-us/archiv...-threading
I have created Threading Object In My Extension from long time i should post the extension now it contains many new things.
ZS
11-25-2024, 12:12 PM
Z-S,
I had read that article before. Good to read and study it again. I think the answer to my question is a called subroutine will run in its own thread. I wonder if there is a way to test it. Is there some way to see the thread you are running on? JR
11-25-2024, 01:28 PM
(11-25-2024, 12:12 PM)jrmrhrb00 Wrote: Z-S, Hi, JR You are wrong. If the subroutine was called by a UI thread, then the subroutine will be executed in the UI thread. If the subroutine is called by an event handler, then the subroutine will run in a separate thread of its own. In addition, a method in the LitDev library allows you to call a subroutine to work in a separate thread: LDCall.CallAsync(dll, extension, obj, method, arguments)
11-25-2024, 08:27 PM
Well, on the internet it says this:
Subroutines in Small Basic do not run on the UI thread. So, that leaves me with I just don't know. I tried resmon, but it just shows all threads, not if it is running on Ui. JR
11-25-2024, 08:51 PM
In this case, we will wait for LitDev's response.
11-25-2024, 09:47 PM
I think AB answer is right, don't believe everything internet says, especially if it came from AI!
If there is specific issue or question on this in addition to the general one then please ask.
11-25-2024, 11:32 PM
LitDev,
I really don't know. Is there any way that you know of that shows if you are running in the UI thread? This could make a major difference in some programs. Say you have a bunch of events where the code in them is too long. So in the front of these events you put a flag and put the excess code in a subroutine. Then in the main code you put an if statement followed by another flag which says true, followed by a call to the sub routine that has the excess code in it. That way your running in the UI and doing updates as needed. So, it would be great if it actually works that way! That way you don't have to move the excess code. Just make it a subroutine! JR PS I hope I didn't confuse anybody.
11-26-2024, 02:59 AM
Currentthread property.
May be I could provide in next extension update.
ZS
|
« Next Oldest | Next Newest »
|