id summary reporter owner description type status milestone component version severity resolution keywords cc 2741 proposal to manage portable and non portablethread attributes viboes viboes "Boost.thread has already a non portable interface to get the thread handle {{{ #!cpp class thread { public: ... typedef np_native_handle_type native_handle_type; native_handle_type native_handle(); ... }; }}} Boost.Thread do not allows to pass thread attributes on the thread constructor. I suppose that this is due to portable issues. Could we identify which attributes are portable and which one not? The portable attributes (as stack size, ...) can be grouped on a thread_attributes class. In order to be able to pass whatever attribute to the thread constructor we can add the setting of non portable attributes to this thread_attributes class, and making the thread constructor take a thread_attributes in addition to the existing parameters. {{{ #!cpp class thread { public: class thread_attributes { // portable attributes public: typedef np_native_handle_type native_handle_type; native_handle_type native_handle(); // set/get of attributes // .. #if defined(BOOST_THREAD_PLATFORM_WIN32) // ... window version #elif defined(BOOST_THREAD_PLATFORM_PTHREAD) private: pthread_attr_t native_attributes; public: thread_attributes() { pthread_attr_init(&native_attributes); } ~thread_attributes() { pthread_attr_destroy(&native_attributes); } // ... other #else #error ""Boost threads unavailable on this platform"" #endif }; thread(const thread_attributes&p, F f,A1 a1); ... }; }}} The portable application needing some specific configuration can construct portable threads using the following schema {{{ #!cpp thread::thread_attributes attr; // set portable attributes // ... attr.set_stack_size(1000000) #if defined(BOOST_THREAD_PLATFORM_WIN32) // ... window version #elif defined(BOOST_THREAD_PLATFORM_PTHREAD) // ... pthread version pthread_attr_setschedpolicy(attr.get_native_handle(), SCHED_RR); #else #error ""Boost threads unavailable on this platform"" #endif thread th(attr, f,ctx); }}}" Feature Requests closed Boost 1.50.0 thread Boost 1.37.0 Not Applicable fixed thread attributes tim@… viboes