Opened 12 years ago

Closed 12 years ago

#4484 closed Bugs (invalid)

bug in boost.thread on freebsd 8.0

Reported by: shubin_evgeniy@… Owned by: Anthony Williams
Milestone: Boost 1.44.0 Component: thread
Version: Boost 1.43.0 Severity: Regression
Keywords: thread freebsd Cc: viboes

Description

I use boost1.43 on FreeBSD 8.0-RELEASE-p3 amd64, installed from ports. Here is a simple program that causes an assertion:

Assertion failed: (!pthread_cond_wait(&cond,m.mutex()->native_handle())), function wait, file ./boost/thread/pthread/condition_variable.hpp, line 20.

during execution.

#include <boost/thread.hpp>
#include <cstdlib>

using namespace std;

void ThreadFun(int number)
{
    sleep(5);
}

int main(int argc, char** argv)
{
    if (argc > 1)
    {
        pid_t pid = fork();
        if (pid < 0)
        {
            return EXIT_FAILURE;
        }
        else if (pid > 0)
        {
            return EXIT_SUCCESS;
        }
    }
    boost::thread th1(boost::bind(&ThreadFun, 1));
    th1.join();
    return EXIT_SUCCESS;
}

Error occurs only when I execute program with command line arguments(when the process forks) and only on freebsd 8.0 (on ubuntu 10.04 x64 and on freebsd 7.3 amd 64 it works correct).

Attachments (1)

main.cpp (549 bytes ) - added by sh 12 years ago.

Download all attachments as: .zip

Change History (5)

by sh, 12 years ago

Attachment: main.cpp added

comment:1 by viboes, 12 years ago

Cc: viboes added

Boost.Thread cleanup when the program exit. Do you know if Boost.Thread can do something to attached a handler when the dlclose is called on its dl handle?

comment:2 by shubin_evgeniy@…, 12 years ago

This bug fixes by compiling with -pthread option of gcc

comment:3 by viboes, 12 years ago

Do you mean that the ticket can be closed or that something must be changed on the way Boost.Thread is built? If the first be free to close it yourself.

Vicente

comment:4 by shubin_evgeniy@…, 12 years ago

Resolution: invalid
Status: newclosed
Note: See TracTickets for help on using tickets.