|
| Inicio → WINDEV 2024 → [WD19] Threads and d_______ functions -- can't perform on separate thread? |
| [WD19] Threads and d_______ functions -- can't perform on separate thread? |
| Iniciado por Andrew, 31,mar. 2015 18:53 - 5 respuestas |
| |
| | | |
|
| |
Miembro registrado 31 mensajes |
|
| Publicado el 31,marzo 2015 - 18:53 |
Hi, all!
So I am trying to alter an image variable in a separate thread. I pass the image variable as a parameter of the procedure which will be ran in the separate thread.
When I call dRotation(imgThreadImage, 90) the Main Thread gets jammed up until the operation is finished, even though it is being called on a separate thread.
To test, I commented out the dRotation() call and replaced it with a Wait(10000) and the Main Thread never jammed up.
What do I have to do to make dRotation play nice and stick to playing inside its own sandbox instead of jumping over to the Main Thread? |
| |
| |
| | | |
|
| | |
| |
| Publicado el 01,abril 2015 - 02:39 |
Hi Andrew
secondary thread should NEVER try to access the UI. The UI is a RESERVED resource of the main thread... It doesn't matter if it's via dxxx functions or simply setting a value in a field, all this needs to be done via a main thread function...
However, nothing prevents you from calling a function of the main thread from a secondary one, as there is a function made specially for that call
A closer look at the threads pages in the help will give you all the details
Best regards
-- Fabrice Harari International WinDev, WebDev and WinDev mobile Consulting
NEW: WXReplication, your open source replication system is available on my web site!!! WXShowroom.com: Show your projects! More information on http://www.fabriceharari.com
On 3/31/2015 10:53 AM, Andrew wrote:
Hi, all!
So I am trying to alter an image variable in a separate thread. I pass the image variable as a parameter of the procedure which will be ran in the separate thread.
When I call dRotation(imgThreadImage, 90) the Main Thread gets jammed up until the operation is finished, even though it is being called on a separate thread.
To test, I commented out the dRotation() call and replaced it with a Wait(10000) and the Main Thread never jammed up.
What do I have to do to make dRotation play nice and stick to playing inside its own sandbox instead of jumping over to the Main Thread? |
| |
| |
| | | |
|
| | |
| |
Miembro registrado 31 mensajes |
|
| Publicado el 01,abril 2015 - 13:25 |
Thank you, Mr. Harari
Unfortunately, my secondary thread does not access my Main Thread (no controls, no global variables... nothing...), yet still manages to hang up my Main/UI Thread. If I call a dxxxxxx function on an image variable created inside of the secondary thread, my Main/UI thread stalls until the dxxxxxxx function is finished.
Any idea why this is happening? Does WinDev's dxxxxxxxx force themselves to execute upon the Main/UI thread internally? |
| |
| |
| | | |
|
| | |
| |
| Publicado el 01,abril 2015 - 14:36 |
Hi Andrew
dxxx functions ARE UI functions... The possibility to draw inside an image VARIABLE is very new, and there is a good chance that it is implemented by using an invisible image field (ie UI)
Best regards
-- Fabrice Harari International WinDev, WebDev and WinDev mobile Consulting
NEW: WXReplication, your open source replication system is available on my web site!!! WXShowroom.com: Show your projects! More information on http://www.fabriceharari.com
On 4/1/2015 5:25 AM, Andrew wrote:
Thank you, Mr. Harari
Unfortunately, my secondary thread does not access my Main Thread (no controls, no global variables... nothing...), yet still manages to hang up my Main/UI Thread. If I call a dxxxxxx function on an image variable created inside of the secondary thread, my Main/UI thread stalls until the dxxxxxxx function is finished.
Any idea why this is happening? Does WinDev's dxxxxxxxx force themselves to execute upon the Main/UI thread internally? |
| |
| |
| | | |
|
| | |
| |
Miembro registrado 31 mensajes |
|
| Publicado el 01,abril 2015 - 17:30 |
Thanks, Mr. Harari...
... WinDev's been falling short for us lately, this is just another example of its inadequacy I guess. Still, WinDev is useful as a tool to create very simple CRUD applications -- I'll just lower my expectations next time I think "Hey, I bet WinDev can do that!" because it probably can't... |
| |
| |
| | | |
|
| | |
| |
| Publicado el 01,abril 2015 - 18:15 |
Hi Andrew
you can continue to think that and abandon windev, or you can learn how to do things in windev and create VERY COMPLEX applications with it...
It's entirely up to you.
And as for your current problem, as I was saying in my first answer, you CAN call a procedure that will do your drawing in the main thread from a secondary one, you just have to use the correct function to do so... And all of that is explained in the thread help.
Best regards
-- Fabrice Harari International WinDev, WebDev and WinDev mobile Consulting
NEW: WXReplication, your open source replication system is available on my web site!!! WXShowroom.com: Show your projects! More information on http://www.fabriceharari.com
On 4/1/2015 9:30 AM, Andrew wrote:
Thanks, Mr. Harari... .... WinDev's been falling short for us lately, this is just another example of its inadequacy I guess. Still, WinDev is useful as a tool to create very simple CRUD applications -- I'll just lower my expectations next time I think "Hey, I bet WinDev can do that!" because it probably can't... |
| |
| |
| | | |
|
| | | | |
| | |
|