This is the mail archive of the cygwin-developers mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Can you undo change in sig_dispatch_pending() ?


Christopher Faylor wrote:

> On Tue, Oct 30, 2007 at 04:35:05PM +0200, Oleg Volkov wrote:
>
> >So it was considered that check of `sigq.start.next' introduces racing
> >condition, and this affects Cygwin stability. But this suggestion is wrong.
>
> No.  It is not.

I have explained, why assumption about racing condition is wrong. My main
argument was: reading and updating a pointer (that is, variable
`sigq.start.next') is performed atomically by CPU, since pointers are of
size `int', and read and assignment to `int' are atomic.

Note, that check of condition `!sigq.start.next' will never cause access
violation, since this expression does not contain references by pointers
(however, a whole expression `sigq.start.next' is the pointer, but there is
no access by its address, it's only checked for being zero/non-zero).

> However, if you think that this check can be put back then it seems like
> the next logical step is to remove the sig_dispatch_pending from readv
> and writev.  Have you tried that?

I suppose, that the purpose of invocation of sig_dispatch_pending() from
readv() and writev() is to dispatch signals as many as possible before
Win32 call, which actually performes input/output, since this call can take
much time, and no signals can be dispatched during it.

But the situation, when some signals are left undispatched before that
Win32 call, can not be prevented completely, since there are many lines of
code between call to sig_dispatch_pending() and Win32 call. Avoiding
check of `sigq.start.next' slightly reduces likelihood of a signal to be
left undispatched at the cost of triple decrease of performance of readv()
and writev().


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]