Opened 13 years ago

Closed 12 years ago

Last modified 12 years ago

#4083 closed Feature Requests (wontfix)

thread_id value not exported.

Reported by: Michael Soliman. <boost@…> Owned by: Anthony Williams
Milestone: Boost 1.43.0 Component: thread
Version: Boost 1.42.0 Severity: Optimization
Keywords: access, functions, public, protected Cc: boost@…

Description

Moin Moin.

Trying to write programmes, using unique ids per thread and only per thread, recommend themselves to be numbered by this_thread:get_id(). Unfortunately, the data-member (in "boost\boost\thread\detail\thread.hpp":line 50.) is both.:

  1. declared private (not protected),
  2. not exported by an access-function.

Right now, in order to maintain maximum compatibility as well as the emission of the same old error-messages, I just added the missing access-functions.: const thread_data&const_Wert(void)const{return thread_data;};

thread_data& Wert(void) {return thread_data;};

Similarly I moved "typedef ... super_t;" in "boost\boost\iterator\filter_iterator.hpp":line 50 to the public-scope, as I needed it for my typedefs and did not see a point in deplaring any typedef as an unpublican(ian)n (for an appropriate n>=0).

Hence my request to.:

  1. generally use the keyword private only iff public/protected access-functions-to the underlying data exist.
  2. To put typedefs in the public/protected area only, or at least to put typedefs in there, allowing acces to all types that might be needed (somewhen.).
  3. To typedef all template-parameters like class Predicate, class Iterator in the aforementioned "filter_iterator.hpp", where, later on I did write a less restricted version of this class (But did not invest the same amount of work, just to add some access-functions.).

Tschuess,

Michael.

P.S.: I did append the ammended version of "Filter_iterator" in order to illustrate, what I meant (sorry for the partly German names.). P2.S.: As I am not a "TeX"-guy, does anyone know how to switch off the superspript mode..

Attachments (1)

fi.h.gz (1.5 KB ) - added by Michael Soliman. <boost@…> 13 years ago.
I did append the ammended version of "Filter_iterator" in order to illustrate, what I meant (sorry for the partly German names.).

Download all attachments as: .zip

Change History (6)

by Michael Soliman. <boost@…>, 13 years ago

Attachment: fi.h.gz added

I did append the ammended version of "Filter_iterator" in order to illustrate, what I meant (sorry for the partly German names.).

comment:1 by Michael Soliman. <boost@…>, 13 years ago

Cc: boost@… added

P3_.S.: Cut & Paste errors prevail. The access-functions should be.: const detail::thread_data_ptr&const_Wert(void)const{return thread_data;};

detail::thread_data_ptr& Wert( void) {return thread_data;};

, of course. _Tschuess, Michael.

comment:2 by Anthony Williams, 12 years ago

Resolution: wontfix
Status: newclosed

The details of thread::id are private for a purpose. The internal contents are not intended for public consumption, and providing such access would break encapsulation.

thread::id is suitable for use as a key in an associative container, so can be used directly as e.g. a map index.

comment:3 by Michael Soliman. <boost@…>, 12 years ago

Resolution: wontfix
Status: closedreopened

Moin Moin. Ok.: "not intended for public consumption" does mean, that the authors did not have the plan to do so. My proposal now implies, that a sensible application to do so arose and can be satisfied without removing any degrees of implementing future functionality from the authors' sphere of influence. My proposal just contains

comment:4 by Anthony Williams, 12 years ago

Resolution: wontfix
Status: reopenedclosed

I disagree that a sensible application for exposing the internals of thread::id has arisen.

I will not be changing thread::id to expose the internals. If you wish to use thread::id as an index, create an associative container such as std::map<boost::thread::id,some_data>.

comment:5 by Michael Soliman. <boost@…>, 12 years ago

Moin Moin.

I disagree that a sensible application for exposing the internals of thread::id has arisen.

Hm. Sorry, I did not mean to be pert. My intention was just to remove a circumventable restriction. As it is a small change, I shall be implementing it within the sources all by myself at anytime I am using a new distribution.

Tschuess,

Michael.

Note: See TracTickets for help on using tickets.