'Pushing' a thread...
-
Hi, I'm wondering if it is possible to 'push' a thread to execute more often when another thread is waiting for some data from the first one? The concret case is the following: My application created a secondary thread for displaying data. The main thread modifies that data and to avoid displaying wrong data I use flags. When the secondary thread is busy, the first one waits until the security flag is reset. Depending on the compiler options the results are different: for 'standard optimization' there is no problem, but for 'speed optimized' the main thread waits forever because somehow the secondary thread doesn't continue... ?? Can someone help ?? Thanks :)
-
Hi, I'm wondering if it is possible to 'push' a thread to execute more often when another thread is waiting for some data from the first one? The concret case is the following: My application created a secondary thread for displaying data. The main thread modifies that data and to avoid displaying wrong data I use flags. When the secondary thread is busy, the first one waits until the security flag is reset. Depending on the compiler options the results are different: for 'standard optimization' there is no problem, but for 'speed optimized' the main thread waits forever because somehow the secondary thread doesn't continue... ?? Can someone help ?? Thanks :)
-
Hi, I'm wondering if it is possible to 'push' a thread to execute more often when another thread is waiting for some data from the first one? The concret case is the following: My application created a secondary thread for displaying data. The main thread modifies that data and to avoid displaying wrong data I use flags. When the secondary thread is busy, the first one waits until the security flag is reset. Depending on the compiler options the results are different: for 'standard optimization' there is no problem, but for 'speed optimized' the main thread waits forever because somehow the secondary thread doesn't continue... ?? Can someone help ?? Thanks :)
Set the priority to THREAD_PRIORITY_HIGHEST or even THREAD_PRIORITY_TIME_CRITICAL, do your stuff and then put it back to THREAD_PRIORITY_NORMAL Nish Sonork ID 100.9786 voidmain www.busterboy.org If you don't find me on CP, I'll be at Bob's HungOut
-
Hi, I'm wondering if it is possible to 'push' a thread to execute more often when another thread is waiting for some data from the first one? The concret case is the following: My application created a secondary thread for displaying data. The main thread modifies that data and to avoid displaying wrong data I use flags. When the secondary thread is busy, the first one waits until the security flag is reset. Depending on the compiler options the results are different: for 'standard optimization' there is no problem, but for 'speed optimized' the main thread waits forever because somehow the secondary thread doesn't continue... ?? Can someone help ?? Thanks :)
-
Hi, I'm wondering if it is possible to 'push' a thread to execute more often when another thread is waiting for some data from the first one? The concret case is the following: My application created a secondary thread for displaying data. The main thread modifies that data and to avoid displaying wrong data I use flags. When the secondary thread is busy, the first one waits until the security flag is reset. Depending on the compiler options the results are different: for 'standard optimization' there is no problem, but for 'speed optimized' the main thread waits forever because somehow the secondary thread doesn't continue... ?? Can someone help ?? Thanks :)
When you say a "flag" do you mean a bool variable? If so, then that is the wrong way to synchronize threads. Use a critical section instead. See InitializeCriticalSection() and related APIs. --Mike-- http://home.inreach.com/mdunn/ Help! Help! I'm being repressed!! :love: your :bob: with :vegemite: and :beer: Sonork - 100.10414 AcidHelm
-
Hi, I'm wondering if it is possible to 'push' a thread to execute more often when another thread is waiting for some data from the first one? The concret case is the following: My application created a secondary thread for displaying data. The main thread modifies that data and to avoid displaying wrong data I use flags. When the secondary thread is busy, the first one waits until the security flag is reset. Depending on the compiler options the results are different: for 'standard optimization' there is no problem, but for 'speed optimized' the main thread waits forever because somehow the secondary thread doesn't continue... ?? Can someone help ?? Thanks :)
Thanks for all your replies. It's right, I forgot to specify the flag as 'volatile'. Without this even when increasing the other thread's priority it wouldn't have worked. But I didn't use a critical section... I'll try to implement it in future :) cheers Marc