Boost logo

Boost :

Subject: Re: [boost] [thread] #2739 shouldn't at_thread_exit work on themain thread?
From: vicente.botet (vicente.botet_at_[hidden])
Date: 2009-05-31 08:39:17


Hi,
----- Original Message -----
From: "Larry Evans" <cppljevans_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Sunday, May 31, 2009 1:52 PM
Subject: Re: [boost] [thread] #2739 shouldn't at_thread_exit work on themain thread?

>
> On 05/31/09 04:01, vicente.botet wrote:
> [snip]
>>
>> OK, I will do like you propose next time. The thread.cpp file corresponds to ./thread/src/pthread/thread.cpp.
>>
>
> Here's what I did.
>
> 1) downloaded:
>
> https://svn.boost.org/trac/boost/export/53346/trunk/libs/thread/src/pthread/thread.cpp
>
> to my boost-trunk directory:
>
> -*- mode: compilation; default-directory:
> "~/prog_dev/boost-svn/ro/boost-trunk/" -*-
> Compilation started at Sun May 31 06:44:20
>
> svn info
> Path: .
> URL: http://svn.boost.org/svn/boost/trunk
> Repository Root: http://svn.boost.org/svn/boost
> Repository UUID: b8fc166d-592f-0410-95f2-cb63ce0dd405
> Revision: 53106
> Node Kind: directory
> Schedule: normal
> Last Changed Author: steven_watanabe
> Last Changed Rev: 53105
> Last Changed Date: 2009-05-18 22:00:53 -0500 (Mon, 18 May 2009)
>
>
> Compilation finished at Sun May 31 06:44:20
>
> so that thread.cpp, revision 53346, overwrote whatever was in the trunk
> (which, as shown above, was revision 53106).
>
> Then I applied the patch. Then created directory:
>
> /boost-trunk/libs/thread/test_patches:
>
> to which I copied your test_ticket_2739.cpp. Then cp'ed the
> libs/thread/test/Jamfile.v2 to the test_patches and changed
> the tests-suite target to:
>
> test-suite "threads"
> : [ thread-run test_ticket_2739.cpp ]
> ;
>
> Then ran with bjam:
>
> -*- mode: compilation; default-directory:
> "~/prog_dev/boost-svn/ro/boost-trunk/libs/thread/test_patches/" -*-
> Compilation started at Sun May 31 06:50:58
>
> bjam
> sh: icpc: not found
> docutils-dir=
> tools-dir= /usr/bin/rst2html.py
> ...patience...
> ...found 1062 targets...
> ...updating 8 targets...
> gcc.compile.c++
> ../../../bin.v2/libs/thread/test_patches/test_ticket_2739.test/gcc-4.2/debug/threading-multi/test_ticket_2739.o
> gcc.link
> ../../../bin.v2/libs/thread/test_patches/test_ticket_2739.test/gcc-4.2/debug/threading-multi/test_ticket_2739
> testing.capture-output
> ../../../bin.v2/libs/thread/test_patches/test_ticket_2739.test/gcc-4.2/debug/threading-multi/test_ticket_2739.run
> **passed**
> ../../../bin.v2/libs/thread/test_patches/test_ticket_2739.test/gcc-4.2/debug/threading-multi/test_ticket_2739.test
> gcc.compile.c++
> ../../../bin.v2/libs/thread/test_patches/test_ticket_2739_lib.test/gcc-4.2/debug/threading-multi/test_ticket_2739.o
> gcc.link
> ../../../bin.v2/libs/thread/test_patches/test_ticket_2739_lib.test/gcc-4.2/debug/threading-multi/test_ticket_2739_lib
> testing.capture-output
> ../../../bin.v2/libs/thread/test_patches/test_ticket_2739_lib.test/gcc-4.2/debug/threading-multi/test_ticket_2739_lib.run
> **passed**
> ../../../bin.v2/libs/thread/test_patches/test_ticket_2739_lib.test/gcc-4.2/debug/threading-multi/test_ticket_2739_lib.test
> ...updated 8 targets...
>
> Compilation finished at Sun May 31 06:51:07

As I said in another post, the patch is not correct. So please do not apply it.
The test case is not currently neither good because the test succeeds even if mycallable2() is not called . In order to test this the operator()() should contains an abort when the called.

struct mycallable2
{
    void operator()() const {
        mycallable2_called=true;
        std::cout << "mycallable2" << std::endl;
***** abort()
    };
};

And the Jamfile should the contain

rule thread-run-fail ( sources )
{
    return
    [ run-fail $(sources) ../build//boost_thread ]
    [ run-fail $(sources) ../src/tss_null.cpp ../build//boost_thread/<link>static
        : : : : $(sources[1]:B)_lib ]
    ;
}

test-suite "threads"
         : [ thread-run-fail test_ticket_2739.cpp ]
     ;

Whithout these modification you can inspect the .output file on the bin.v2 directory and see if the trace "mycallable2" appears.
Could you run the test case without applying the patch and send the output?

Thanks,
Vicente


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