Boost logo

Boost :

Subject: Re: [boost] [thread] patch to allow custom stack size.
From: Vicente Botet (vicente.botet_at_[hidden])
Date: 2011-12-02 03:18:38


Geoff Shapiro wrote
>
> Vicente J. Botet Escriba <vicente.botet <at> wanadoo.fr> writes:
>> I don't know. I have submitted a more generic patch *3 years* ago and
>> there is no response yet.
>> https://svn.boost.org/trac/boost/ticket/2741 :proposal to manage
>> portable and non portable thread attributes
>>
>> Btw, could you take a look at the ticket and tell me what do you think
>> of my proposal?
>
> Vicente, I have looked at your proposal and I like the direction you
> headed with
> that set of patches. There was a recent request for changes to
> boost::thread to
> allow priority inheritance on thread creation (pthread environments) and
> your
> proposal would cover that with no problem.
>
> I'd like to see in your example how you see a user incorporating thread
> attribute settings for non-portable attributes.
>

Here it is what I wrote: "
The portable application needing some specific configuration can construct
portable threads using the following schema

        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);
"

Isn't this enough clear?

> Other thoughts that could be considered:
>
> 1. Would thread priority setting be considered a portable or non-portable
> attribute? There does seem to be quite a bit of variation in this amongst
> different environments. It would be nice if it could be generalized and
> reconciled amongst the different environments.
>

I don't think so.

> 2. It might be a good thing to be able to specify a default attribute set
> to be
> used in a constructor version not taking an attribute object reference
> (this is
> the current constructor).
>
>

The current constructor uses the default native attributes. Is this what you
mean?

Best,
Vicente

--
View this message in context: http://boost.2283326.n4.nabble.com/thread-patch-to-allow-custom-stack-size-tp4123581p4145618.html
Sent from the Boost - Dev mailing list archive at Nabble.com.

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk