[PATCH] cygwin_internal methods to get/set thread name
Corinna Vinschen
corinna-cygwin@cygwin.com
Wed Dec 20 11:51:00 GMT 2017
Hi Mark,
A lot to discuss here.
First of all, can you please describe the scenario in which you'd want
to give a cygthread another name? Why is the one given at
cygthread::create time not sufficient?
Also, why should we need another, non-standard way to read/write a
pthread name, other than pthread_getname_np/pthread_setname_np? What is
that supposed to accomplish? Is there really any real-world scenario
which you can't handle with the official entry points?
We really don't want to add more non-standard entry points than
absolutely necessary. There are too many already, partially for
historic reasons.
On Dec 20 00:08, Mark Geisert wrote:
> Add support to cygwin_internal() for setting a cygthread name and getting or setting a pthread name. Also add support for getting the internal i/o handle for a given file descriptor.
Can you please break the log message in lines <= 72 chars?
> @@ -710,6 +743,14 @@ cygwin_internal (cygwin_getinfo_types t, ...)
> }
> break;
>
> + case CW_GET_IO_HANDLE_FROM_FD:
> + {
> + int fd = va_arg(arg, int);
> + fhandler_base *fh = cygheap->fdtab[fd];
> + res = (uintptr_t) (fh->get_io_handle ());
> + }
> + break;
> +
> default:
> set_errno (ENOSYS);
> }
Nope, we won't do that. The functionality is already available via
_get_osfhandle included via <io.h>.
Also, note that this is, and always will be a kludge. There are
scenarios in which more than one handle is attached to a descriptor
(e.g., ptys) and the function will return only one.
Thanks,
Corinna
--
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Maintainer cygwin AT cygwin DOT com
Red Hat
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin-patches/attachments/20171220/1e1c0136/attachment.sig>
More information about the Cygwin-patches
mailing list