Re: MSDN volatile sample
- From: "Alexander Grigoriev" <alegr@xxxxxxxxxxxxx>
- Date: Sat, 29 Dec 2007 06:50:23 -0800
Sleep(0) is causing kernel trip anyway (lots of them in the usual case,
since it's called in a loop), compared to only 2 for WFSO/SetEvent pair. And
this loop doesn't allow to stop processor clock to reduce CPU power. When I
see an application comsuming 100%, that gives me doubts about its general
quality, and I get rid of it.
"Alex Blekhman" <tkfx.REMOVE@xxxxxxxxx> wrote in message
news:uFdF0$WSIHA.3940@xxxxxxxxxxxxxxxxxxxxxxx
"Alexander Grigoriev" wrote:
Anyway, the sample illustrates very poor synchronization practice which
should not be followed. Proper signalling using events makes volatile
qualifier unnecessary.
There is nothing wrong with this technique if it used correctly.
Synchronization with events or other kernel objects brings the high price
of user space to kernel space trip. It is not uncommon that you need to
synchronize within single process only. In these cases volatile variables
may provide adequate solution.
Alex
.
- Follow-Ups:
- Re: MSDN volatile sample
- From: George
- Re: MSDN volatile sample
- References:
- Re: MSDN volatile sample
- From: Norbert Unterberg
- Re: MSDN volatile sample
- From: Norbert Unterberg
- Re: MSDN volatile sample
- From: George
- Re: MSDN volatile sample
- From: ajk
- Re: MSDN volatile sample
- From: George
- Re: MSDN volatile sample
- From: Alex Blekhman
- Re: MSDN volatile sample
- From: George
- Re: MSDN volatile sample
- From: Alexander Grigoriev
- Re: MSDN volatile sample
- From: Alex Blekhman
- Re: MSDN volatile sample
- Prev by Date: Re: Non-inline template specialization of member function okay?
- Next by Date: Re: MSDN volatile sample
- Previous by thread: Re: MSDN volatile sample
- Next by thread: Re: MSDN volatile sample
- Index(es):
Relevant Pages
|