X-Spam-Check-By: sourceware.org To: cygwin AT cygwin DOT com From: mwoehlke Subject: Re: rsync over ssh hang issue understood Date: Fri, 30 Jun 2006 16:37:59 -0500 Lines: 35 Message-ID: References: <44A348D1 DOT 6070908 AT netbauds DOT net> <44A507F8 DOT 4030409 AT netbauds DOT net> <44A53F4B DOT 4070503 AT netbauds DOT net> <44A57EC6 DOT 2060805 AT netbauds DOT net> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit User-Agent: Thunderbird 1.5.0.4 (X11/20060516) In-Reply-To: <44A57EC6.2060805@netbauds.net> X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com 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/