|
Boost : |
Subject: Re: [boost] boost::tasks::static_pool< boost::tasks::unbounded_fifo > crashes when poolsize > 1
From: Oliver Kowalke (k-oli_at_[hidden])
Date: 2010-12-14 13:21:38
You are using std::cout from mutlitple threads - is not a threadsafe
operation. Try to protect it with a mutex or use another threadsafe op.
Am 13.12.2010 18:17, schrieb Joseph Winston:
> I've attached a program that reproduces the problem for me.
>
> The system this is running on is the following (Yes, I know it is old
> but I have very little control over the OS and compiler):
>
> Distribution: RHEL 4
> $ uname -a
> Linux jwhp8400.houston.lgc.com 2.6.9-67.ELsmp #1 SMP Wed Nov 7 13:56:44
> EST 2007 x86_64 x86_64 x86_64 GNU/Linux
>
> Compiler: g++ 3.4.6
> boost: 1.39.0
> boost.context: 0.2.0
> boost.fiber: 0.5.1
> boost.task: svn revision 67209
>
> The code of interest is:
>
> void f1()
> {
> std::cout << "\t"
> << "f1" << std::endl;
> }
>
> void f2()
> {
> std::cout << "\t"
> << "f2" << std::endl;
> }
>
> void
> demo()
> {
> typedef boost::tasks::static_pool< boost::tasks::unbounded_fifo >
> pool_type;
> pool_type pool(boost::tasks::poolsize(4),
> boost::tasks::stacksize(1024 * 128));
>
> std::cout << "Starting" << std::endl;
> boost::tasks::async(boost::tasks::make_task(f1),
> pool);
> boost::tasks::async(boost::tasks::make_task(f2),
> pool);
>
> pool.shutdown();
>
> std::cout << "Done" << std::endl;
> }
>
> Whenever poolsize is greater than 1, I sometimes receive the following
> sigsegv:
>
> (gdb) where
> #0 0x0000002a95d7d8db in boost::fibers::detail::trampoline
> (vp=0xffffffff96400ac0) at libs/fiber/src/detail/info_base.cpp:25
> #1 0x0000003c0203e960 in __correctly_grouped_prefixwc () from
> /lib64/tls/libc.so.6
> #2 0x0000000000000000 in ?? ()
> (gdb) print *self
> Cannot access memory at address 0xffffffff96400ac0
>
> Am I missing a fundamental concept with the way that
> boost::tasks::static_pool works or is there something else going on?
>
> Thanks
>
>
>
> _______________________________________________
> Unsubscribe& other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk