[PATCH v2] Cygwin: Change pthread_sigqueue() to accept thread id
Mark Geisert
mark@maxrnd.com
Mon Nov 4 02:02:10 GMT 2024
Hi Christian,
On 11/3/2024 3:15 AM, Christian Franke wrote:
> Mark Geisert wrote:
>> Hi Corinna,
>>
>> On 10/22/2024 7:45 AM, Corinna Vinschen wrote:
[...]
>>> 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?
>
> If backward compatibility with existing binaries using
> pthread_sigqueue() is desired, I would suggest:
> - Keep functionality and export symbol of the existing pthread_sigqueue().
> - Use a different export symbol for the new function.
> - By default, map the pthread_sigqueue() call to the new symbol.
> - Invent a #define that allows to use the old function.
>
> pthread.h:
> ...
> // TODO: Add some comment explaining this hack :-)
> int _pthread_sigqueue_with_id(pthread_t, int, const union sigval);
>
> #ifdef _CYGWIN_USE_OLD_PTHREAD_SIGQUEUE
> int pthread_sigqueue (pthread_t *, int, const union sigval)
> __attribute__((__warning__("Using old version of pthread_sigqueue()")));
> #else
> int pthread_sigqueue (pthread_t, int, const union sigval)
> __asm__("_pthread_sigqueue_with_id");
> #endif
Yes, this or something like it would seem to work. The issue to be
solved also looks like something Cygwin API version bumps are for.
I await Corinna's input.
Thanks & Regards,
..mark
More information about the Cygwin-patches
mailing list