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.
One point from my last post was:
> Select justs need to lookup the outstanding by count and update the
write_ready state based on the threshold.
I need to revise that, in that all decrement operations on the
outstanding byte count need to re-test for the new decremented value
ends is below the threshold to allow more IO to occur. If so it should
_consider_ waking up all threads waiting on the fd under select(2).
That consideration would be along the lines of:
* If there is blocked IO already waiting behind the serialization gate
to come through, then this instance of the io completion routine is not
responsible for waking up select(2). That responsibility passes to the
next IO after it has come through the gate and called WriteFileEx() and
then added its byte count to the outstanding byte count as necessary.
* If there is no blocked IO waiting at the gate to come through, then
its the responsibility of this completion routine to wake up select waiters.
This is to stop false writable events from waking up select then we
already have an IO queued up and blocked.
Darryl
--
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/