[PATCH v2] Cygwin: Change pthread_sigqueue() to accept thread id

Mark Geisert mark@maxrnd.com
Sun Nov 3 08:44:17 GMT 2024


Hi Corinna,

On 10/22/2024 7:45 AM, Corinna Vinschen wrote:
> Hi Mark,
> 
> Thanks for looking into this.
> 
> On Sep 19 02:13, Mark Geisert wrote:
>> Change the first parameter of pthread_sigqueue() to be a thread id rather
>> than a thread pointer. The change is to match the Linux implementation of
>> this function.
>>
>> The user-visible function prototype is changed. Simple list iteration is
>> added to the threadlist code. A lookup-by-id function is added to class
>> pthread. The pthread_sigqueue() function is modified to work with a
>> passed-in thread id rather than an indirect thread pointer as before.
>> (It was "pthread_t *thread", i.e., class pthread **.) The release note
>> for Cygwin 3.6.0 is updated.
> 
> Even if the old prototype was wrong, we probably have to keep it for
> backward compatibility.  As unlikely as it seems, but there may be
> binaries out there actually using the old prototype.
> 
> We can discuss this probability, but assuming we want to keep backward
> compat at all cost, we would have to

No need to discuss. I'm happy keeping backward compatibility.

> - create a new function like pthread_sigqueue_with_correct_prototype (heh)
> 
> - Add this function to cygwin.din as exported symbol
> 
> - Add a matching entry to NEW_FUNCTIONS in Makefile.am, e.g.,
> 
>      pthread_sigqueue=pthread_sigqueue_with_correct_prototype,
> 
> - Implement either pthread_sigqueue_with_correct_prototype calling
>    pthread_sigqueue or vice versa, whatever makese more sense.

I appreciate your redirecting me towards an acceptable solution. I've 
re-implemented the fix as you've indicated but there's one thing I 
cannot figure out. (BTW I implemented a new pthread_sigqueue_portable() 
calling existing pthread_sigqueue().)

In cygwin/include/pthread.h, should both function names appear or just 
pthread_sigqueue? If the latter, which version of prototype? It seems 
problematic: We want the include file to have the new, portable, 
prototype for pthread_sigqueue() don't we? Doesn't that require that the 
original pthread_sigqueue() be renamed to something else and have it 
call the new pthread_sigqueue()? Maybe that changes one or more of the 
steps you wrote above?
Thanks & Regards,

..mark


More information about the Cygwin-patches mailing list