Darryl Miles wrote:
mwoehlke wrote:
Darryl Miles wrote:
[snip]
* The outstanding byte count needs to be protected by a mutex.
Are you familiar with the Interlocked* family of functions? Depending
on what exactly you need to do with the value, a mutex may be
unnecessary.
Do these function perform buslock prefixed increment/add with memory
operand. As per Linux kernel /usr/src/linux/include/asm-i386/atomic.h.
Its an atomic add operation that would be needed, but I dont think that
will be the only thing that will need intra-thread protection. The
close() case flag setting might need to be involved too as well as other
things, like we need serialization.
Um... probably? Did you try looking at them? There is an
InterlockedExchangeAdd (I think that's the right name... anyway, you
feed it a pointer and a constant, and you get back the previous value).
At any rate, anything Linux can do in assembly, Windows can also do,
also in assembly, with it's own __asm keyword. The syntax is a little
different, but it's there, and for something as speed-sensitive as I
would guess pipes are, this sort of optimization is probably a Good Thing.
Mostly, there is an Interlocked function that will save you from inline
assembly of most assembly instructions that accept the 'lock' prefix.
Of course, if it can't be done without a mutex in assembly, then it
can't be done without a mutex, and you remain the person (as opposed to
me) that knows the answer to that question.
--
Matthew
Do not expose to hippos. Doing so may void your warranty.
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/