delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2006/06/30/17:38:25

X-Spam-Check-By: sourceware.org
To: cygwin AT cygwin DOT com
From: mwoehlke <mwoehlke AT tibco DOT com>
Subject: Re: rsync over ssh hang issue understood
Date: Fri, 30 Jun 2006 16:37:59 -0500
Lines: 35
Message-ID: <e845jo$4s6$1@sea.gmane.org>
References: <44A348D1 DOT 6070908 AT netbauds DOT net> <ba40711f0606291839p2e1d7b10l7befd8cf2cc2d1a7 AT mail DOT gmail DOT com> <44A507F8 DOT 4030409 AT netbauds DOT net> <44A53F4B DOT 4070503 AT netbauds DOT net> <e83hnt$lve$1 AT sea DOT gmane DOT org> <44A57EC6 DOT 2060805 AT netbauds DOT net>
Mime-Version: 1.0
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
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019