[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gentoo-portage-dev
Subject:    Re: [gentoo-portage-dev] blech... (multijob/multiprocessing work-around for cygwin)
From:       Zac Medico <zmedico () gentoo ! org>
Date:       2012-09-24 16:08:37
Message-ID: 50608585.2070009 () gentoo ! org
[Download RAW message or body]

On 09/24/2012 03:25 AM, Gregory M. Turner wrote:
> +# try real hard to figure out if this is a cygwin host; cache results.
> +this_host_is_cygwin() {
> +    if [[ -n ${_this_host_is_cygwin} ]] ; then
> +        return $_this_host_is_cygwin
> +    fi
> +    [[ -x ${EPREFIX}/usr/bin/uname ]] && \
> +        [[ $( ${EPREFIX}/usr/bin/uname -o 2>/dev/null ) == Cygwin* ]] && \
> +            export _this_host_is_cygwin=0 && return 0

You could probably just assume that uname is in $PATH and remove all the
other tests.

>  multijob_finish_one() {
>      local pid ret
> -    read -r -u ${mj_control_fd} pid ret
> +    multijob_assert
> +    if this_host_is_cygwin ; then
> +        read -r pid ret < ${mj_control_pipe}
> +    else
> +        read -r -u ${mj_control_fd} pid ret
> +    fi
>      : $(( --mj_num_jobs ))
>      return ${ret}
>  }
Since you re-open the pipe for each read, there's a race condition which
I've explained here:

http://permalink.gmane.org/gmane.linux.gentoo.devel/77528
-- 
Thanks,
Zac


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic