[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-devel
Subject: Re: Active objects, threads, signals & slots
From: Jasem Mutlaq <mutlaqja () ku ! edu>
Date: 2002-11-06 1:58:39
[Download RAW message or body]
> while (true) {
> wait_for_something_to_happen_with_timeout
> if (something_happened) {
> process
> }
> if (userCancelled) {
> do_a_clean_exit
> }
> }
>
> Most of the time is spent waiting.
>
I exactly have the same problem, the main application updates a message queue,
the client checks if the queue has any messages, and if there is, it
dispatches them.
while (true)
{
// semaphore
sem_wait(&semdata)
if (!message.empty())
dispatch(message);
sem_post(&semdata);
}
But the above looks like it's going to burn the CPU. Any ideas?
Jasem Mutlaq
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic