From kde-devel Wed Nov 06 01:58:39 2002 From: Jasem Mutlaq Date: Wed, 06 Nov 2002 01:58:39 +0000 To: kde-devel Subject: Re: Active objects, threads, signals & slots X-MARC-Message: https://marc.info/?l=kde-devel&m=103654802825829 > while (true) { > wait_for_something_to_happen_with_timeout > if (something_happened) { > process > } > if (userCancelled) { > do_a_clean_exit > } > } >=20 > Most of the time is spent waiting. >=20 I exactly have the same problem, the main application updates a message q= ueue,=20 the client checks if the queue has any messages, and if there is, it=20 dispatches them. while (true) { // semaphore sem_wait(&semdata) =20 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 <<