[ 
https://issues.apache.org/jira/browse/STDCXX-536?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12595034#action_12595034
 ] 

vitek edited comment on STDCXX-536 at 5/7/08 1:48 PM:
-------------------------------------------------------------

Proposed patch allows each call to {{rw_thread_pool()}} to specify a soft 
timeout in seconds. A non-zero timeout will cause a timer to be started when 
pool threads are spawned. When the timer expires, a flag will be set. The user 
thread function will need to poll this flag periodically through the function 
{{rw_thread_timeout_expired()}}, and if it is true the thread should return as 
soon as is reasonably possible.

Please review and provide feedback.

{noformat}
2008-05-07  Travis Vitek  <[EMAIL PROTECTED]>

        STDCXX-536
        * tests/include/rw_thread.h: Reduce C linkage to areas that
        actually need it, add typedef for thread function type.
        (rw_thread_pool): Add timeout parameter with default value.
        (rw_thread_pool_timeout_expired): New function declaration.
        * tests/src/thread.cpp: (_rw_timeout_handler): New function
        to respond to alarm signals and set timeout flag.
        (rw_thread_pool_timeout_expired): New function to query
        timeout status.
        (rw_thread_pool): Set alarm based on timeout value.
        * tests/localization/22.locale.codecvt.mt.cpp: Add timeout
        option with default value. Pass timeout to rw_thread_pool().
        Poll rw_thread_pool_time_expired() in thread function and
        respond. Removed rw_ prefix used by test driver symbols.
        * tests/localization/22.locale.cons.mt.cpp: Ditto.
        * tests/localization/22.locale.ctype.mt.cpp: Ditto.
        * tests/localization/22.locale.globals.mt.cpp: Ditto.
        * tests/localization/22.locale.messages.mt.cpp: Ditto.
        * tests/localization/22.locale.money.get.mt.cpp: Ditto.
        * tests/localization/22.locale.money.put.mt.cpp: Ditto.
        * tests/localization/22.locale.moneypunct.mt.cpp: Ditto.
        * tests/localization/22.locale.num.get.mt.cpp: Ditto.
        * tests/localization/22.locale.num.put.mt.cpp: Ditto.
        * tests/localization/22.locale.numpunct.mt.cpp: Ditto.
        * tests/localization/22.locale.statics.mt.cpp: Ditto.
        * tests/localization/22.locale.time.get.mt.cpp: Ditto.
        * tests/localization/22.locale.time.put.mt.cpp: Ditto.
{noformat}

      was (Author: vitek):
    Proposed patch allows each call to {{rw_thread_pool()}} to specify a soft 
timeout in seconds. A non-zero timeout will cause a timer to be started when 
pool threads are spawned. When the timer expires, a flag will be set. The user 
thread function will need to poll this flag periodically through the function 
{{rw_thread_timeout_expired()}}, and if it is true the thread should return as 
soon as is reasonably possible.

Please review and provide feedback.

{noformat}
2008-05-07  Travis Vitek  <[EMAIL PROTECTED]>

        STDCXX-536
        * tests/include/rw_thread.h: Reduce C linkage to areas that
        actually need it, add typedef for thread function type.
        (rw_thread_pool): Add timeout parameter with default value.
        (rw_thread_pool_timeout_expired): New function declaration.
        * tests/src/thread.cpp: (_rw_timeout_handler): New function
        to respond to alarm signals and set timeout flag.
        (rw_thread_pool_timeout_expired): New function to query
        timeout status.
        (rw_thread_pool): Set alarm based on timeout value.
        * tests/localization/22.locale.codecvt.mt.cpp: Add timeout
        option with default value. Pass timeout to rw_thread_pool().
        Poll rw_thread_pool_time_expired() in thread function and
        respond.
        * tests/localization/22.locale.cons.mt.cpp: Ditto.
        * tests/localization/22.locale.ctype.mt.cpp: Ditto.
        * tests/localization/22.locale.globals.mt.cpp: Ditto.
        * tests/localization/22.locale.messages.mt.cpp: Ditto.
        * tests/localization/22.locale.money.get.mt.cpp: Ditto.
        * tests/localization/22.locale.money.put.mt.cpp: Ditto.
        * tests/localization/22.locale.moneypunct.mt.cpp: Ditto.
        * tests/localization/22.locale.num.get.mt.cpp: Ditto.
        * tests/localization/22.locale.num.put.mt.cpp: Ditto.
        * tests/localization/22.locale.numpunct.mt.cpp: Ditto.
        * tests/localization/22.locale.statics.mt.cpp: Ditto.
        * tests/localization/22.locale.time.get.mt.cpp: Ditto.
        * tests/localization/22.locale.time.put.mt.cpp: Ditto.
{noformat}
  
> allow thread safety tests to time out without failing
> -----------------------------------------------------
>
>                 Key: STDCXX-536
>                 URL: https://issues.apache.org/jira/browse/STDCXX-536
>             Project: C++ Standard Library
>          Issue Type: Improvement
>          Components: Tests
>    Affects Versions: 4.2.0
>            Reporter: Martin Sebor
>            Assignee: Travis Vitek
>             Fix For: 4.2.2
>
>         Attachments: stdcxx-536.patch
>
>   Original Estimate: 3h
>  Remaining Estimate: 3h
>
> The newly added thread safety tests (and possibly some of the existing ones) 
> tend to run for a long time, consuming a lot of CPU cycles, and sometimes 
> even failing due to a timeout (currently 300 seconds in nightly builds). It 
> would be useful to provide a mechanism such as a command line option whereby 
> the tests' runtime could be limited without necessarily causing them to fail 
> when the amount of time is exceeded. One way to do it would be for each test 
> to set an alarm in response to this command line option and in handler for 
> the alarm set a flag that each thread would check at each iteration of its 
> loop to see if it should break.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to