Click here to Skip to main content
15,915,873 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Changing a disabled edit ctrl's color. Pin
Mark Salsbery23-Jul-08 10:12
Mark Salsbery23-Jul-08 10:12 
GeneralRe: Changing a disabled edit ctrl's color. Pin
led mike23-Jul-08 11:46
led mike23-Jul-08 11:46 
QuestionWhy doesn't message pump/loop block all threads? Pin
sawerr23-Jul-08 7:38
sawerr23-Jul-08 7:38 
AnswerRe: Why doesn't message pump/loop block all threads? Pin
Mark Salsbery23-Jul-08 8:11
Mark Salsbery23-Jul-08 8:11 
GeneralRe: Why doesn't message pump/loop block all threads? Pin
sawerr23-Jul-08 8:18
sawerr23-Jul-08 8:18 
GeneralRe: Why doesn't message pump/loop block all threads? Pin
Luc Pattyn23-Jul-08 8:30
sitebuilderLuc Pattyn23-Jul-08 8:30 
GeneralRe: Why doesn't message pump/loop block all threads? Pin
sawerr23-Jul-08 8:35
sawerr23-Jul-08 8:35 
GeneralRe: Why doesn't message pump/loop block all threads? Pin
Luc Pattyn23-Jul-08 8:49
sitebuilderLuc Pattyn23-Jul-08 8:49 
Hi,

GetMessage() {
    if(queue == EMPTY) {
        queue.AddWaiter(currentThread);
        SwitchToForemostReadyThread();
    }
    return queue.RemoveMsg();
}


PutMessage(Message msg) {
    queue.AddMsg(msg);
    if(queue.HasWaitersWithHigherPriority(myPriority)) {
        Thread thread=queue.RemoveWaiter();
        SwitchToThread(thread);
    }
}


Not a single busy-wait or polling loop!
The heart in the matter is the SwitchTo...Thread() methods save the current thread
state on its stack, and load another thread's state from its stack, effectively
performing a "thread switch".

Smile | :)

Luc Pattyn [Forum Guidelines] [My Articles]

Voting for dummies? No thanks. Dead | X|


GeneralRe: Why doesn't message pump/loop block all threads? Pin
Mark Salsbery23-Jul-08 8:48
Mark Salsbery23-Jul-08 8:48 
GeneralRe: Why doesn't message pump/loop block all threads? Pin
sawerr23-Jul-08 9:17
sawerr23-Jul-08 9:17 
QuestionUnditable combobox via code Pin
hariakuthota23-Jul-08 7:14
hariakuthota23-Jul-08 7:14 
QuestionRe: Unditable combobox via code Pin
CPallini23-Jul-08 7:21
mveCPallini23-Jul-08 7:21 
AnswerRe: Unditable combobox via code Pin
hariakuthota23-Jul-08 8:38
hariakuthota23-Jul-08 8:38 
GeneralRe: Unditable combobox via code Pin
JudyL_MD23-Jul-08 9:02
JudyL_MD23-Jul-08 9:02 
GeneralRe: Unditable combobox via code Pin
hariakuthota23-Jul-08 9:11
hariakuthota23-Jul-08 9:11 
GeneralRe: Unditable combobox via code Pin
CPallini23-Jul-08 9:30
mveCPallini23-Jul-08 9:30 
GeneralRe: Unditable combobox via code Pin
JudyL_MD23-Jul-08 10:10
JudyL_MD23-Jul-08 10:10 
AnswerRe: Unditable combobox via code Pin
hariakuthota23-Jul-08 8:43
hariakuthota23-Jul-08 8:43 
QuestionRun time error when ticked the option "owner draw" for a button Pin
hariakuthota23-Jul-08 6:53
hariakuthota23-Jul-08 6:53 
AnswerRe: Run time error when ticked the option "owner draw" for a button Pin
CPallini23-Jul-08 6:56
mveCPallini23-Jul-08 6:56 
GeneralRe: Run time error when ticked the option "owner draw" for a button Pin
Luc Pattyn23-Jul-08 7:11
sitebuilderLuc Pattyn23-Jul-08 7:11 
GeneralRe: Run time error when ticked the option "owner draw" for a button Pin
CPallini23-Jul-08 7:13
mveCPallini23-Jul-08 7:13 
GeneralRe: Run time error when ticked the option "owner draw" for a button Pin
Luc Pattyn23-Jul-08 8:04
sitebuilderLuc Pattyn23-Jul-08 8:04 
GeneralRe: Run time error when ticked the option "owner draw" for a button Pin
CPallini23-Jul-08 9:26
mveCPallini23-Jul-08 9:26 
Questionhow to truncate a string based on buffer size. Pin
Nandu_77b23-Jul-08 6:26
Nandu_77b23-Jul-08 6:26 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.