Discussion:
Posix Thread name
Tony Butt
2004-05-04 03:09:57 UTC
Permalink
I had a requirement to be able to explicitly set the name of a posix thread,
made some simple changes to posix/current/src/pthread.cxx and
posix/current/include/types.h, and can now optionally set the name of a
posix thread created using pthread_create.

The name is set by assigning a value to pthread_attr.name before calling
pthread_create().

A patch to do this is attached. If this should be sent anywhere else, please
let me know...

Tony Butt
Software Engineer
CEA Technologies

***@cea.com.au
Ph: 02 62130195
Fax: 02 62130013
Andrew Lunn
2004-05-13 14:01:14 UTC
Permalink
Post by Tony Butt
I had a requirement to be able to explicitly set the name of a posix thread,
made some simple changes to posix/current/src/pthread.cxx and
posix/current/include/types.h, and can now optionally set the name of a
posix thread created using pthread_create.
The name is set by assigning a value to pthread_attr.name before calling
pthread_create().
As far as i can see, there is nothing in the POSIX pthread standard
like this.

Even if there was, i doubt it would be done by directly modifying the
pthread_attr structure. I would expect the POSIX people to add two new
functions, pthread_attr_setname() and pthread_attr_getname().

I think adding arbitry extensions like this to a standardized API is a
bad idea. So im tempted to not accept this contribution. Feel free to
try to change my mind.

Andrew
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss
Tim Sohacki
2004-05-13 14:07:31 UTC
Permalink
fyi, Wade Jensen previously solved this with the patch at:
http://sources.redhat.com/ml/ecos-discuss/2002-06/msg00104.html

Cheers,
Tim.



-----Original Message-----
From: ecos-discuss-***@ecos.sourceware.org
[mailto:ecos-discuss-***@ecos.sourceware.org] On Behalf Of Andrew Lunn
Sent: Thursday, May 13, 2004 10:01 AM
To: Tony Butt
Cc: ecos-***@ecos.sourceware.org
Subject: Re: [ECOS] Posix Thread name
Post by Tony Butt
I had a requirement to be able to explicitly set the name of a posix
thread, made some simple changes to posix/current/src/pthread.cxx and
posix/current/include/types.h, and can now optionally set the name of
a posix thread created using pthread_create.
The name is set by assigning a value to pthread_attr.name before
calling pthread_create().
As far as i can see, there is nothing in the POSIX pthread standard like
this.

Even if there was, i doubt it would be done by directly modifying the
pthread_attr structure. I would expect the POSIX people to add two new
functions, pthread_attr_setname() and pthread_attr_getname().

I think adding arbitry extensions like this to a standardized API is a
bad idea. So im tempted to not accept this contribution. Feel free to
try to change my mind.

Andrew
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss
Dan Jakubiec
2004-05-13 14:33:49 UTC
Permalink
I also ran into a similar problem a while ago. I never found any POSIX-defined way of assigned
thread names, so I just implemented my own private functions to do so.

But I agree that these sorts of non-standard POSIX enhancements probably don't belong in the
public repository. A bit of a bummer, but what I don't think there is much that can be done about
it.

--
Dan Jakubiec
Systech Corp
Post by Tim Sohacki
http://sources.redhat.com/ml/ecos-discuss/2002-06/msg00104.html
Cheers,
Tim.
-----Original Message-----
Sent: Thursday, May 13, 2004 10:01 AM
To: Tony Butt
Subject: Re: [ECOS] Posix Thread name
Post by Tony Butt
I had a requirement to be able to explicitly set the name of a posix
thread, made some simple changes to posix/current/src/pthread.cxx and
posix/current/include/types.h, and can now optionally set the name of
a posix thread created using pthread_create.
The name is set by assigning a value to pthread_attr.name before
calling pthread_create().
As far as i can see, there is nothing in the POSIX pthread standard like
this.
Even if there was, i doubt it would be done by directly modifying the
pthread_attr structure. I would expect the POSIX people to add two new
functions, pthread_attr_setname() and pthread_attr_getname().
I think adding arbitry extensions like this to a standardized API is a
bad idea. So im tempted to not accept this contribution. Feel free to
try to change my mind.
Andrew
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss
__________________________________
Do you Yahoo!?
Yahoo! Movies - Buy advance tickets for 'Shrek 2'
http://movies.yahoo.com/showtimes/movie?mid=1808405861
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss
Tony Butt
2004-05-16 22:43:18 UTC
Permalink
On Thu, 13 May 2004 16:01:14 +0200
Post by Andrew Lunn
Post by Tony Butt
I had a requirement to be able to explicitly set the name of a posix thread,
made some simple changes to posix/current/src/pthread.cxx and
posix/current/include/types.h, and can now optionally set the name of a
posix thread created using pthread_create.
The name is set by assigning a value to pthread_attr.name before calling
pthread_create().
As far as i can see, there is nothing in the POSIX pthread standard
like this.
Yes - I don't think there is even a concept of a thread name, so certainly no mechanism to set one.
Post by Andrew Lunn
Even if there was, i doubt it would be done by directly modifying the
pthread_attr structure. I would expect the POSIX people to add two new
functions, pthread_attr_setname() and pthread_attr_getname().
Yes, that would be more in line with the general posix threads approach.
Post by Andrew Lunn
I think adding arbitry extensions like this to a standardized API is a
bad idea. So im tempted to not accept this contribution. Feel free to
try to change my mind.
My intent was to provide a mechanism to set the name before the thread was created,
in the same way that some other attributes are set. I don't know if the contents of
pthread_attr_t are completely specified, or just the interface functions (my Posix references are
a bit thin on the ground here). That would be my only grounds for requesting an inclusion (thin as they are)

Thanks for looking at it anyway...
Post by Andrew Lunn
Andrew
--
----------------------------------

Tony Butt
CEA Technologies
----------------------------------
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss
Tony Butt
2004-05-17 04:02:27 UTC
Permalink
While we are at it, I don't suppose there is a pre-existing way to suspend
and resume a posix thread, short of my writing my own
pthread_resume()/pthread_suspend pair, and further bending the posix spec?

Tony Butt

CEA Technologies
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss
Continue reading on narkive:
Loading...