Questions tagged [boost-thread]

Boost.Thread enables the use of multiple threads of execution with shared data in portable C++ code.

Boost.Thread enables the use of multiple threads of execution with shared data in portable C++ code. It provides classes and functions for managing the threads themselves, along with others for synchronizing data between the threads or providing separate copies of data specific to individual threads.

The Boost.Thread library was originally written and designed by William E. Kempf. For Boost 1.35+, Anthony Williams performed a major rewrite designed to closely follow the proposals presented to the C++ Standards Committee, in particular N2497, N2320, N2184, N2139, and N2094.

As of Boost version 1.50.0 Boost.Thread provides an almost complete implementation of the C++ 2011 Threads library, plus extensions such as shared locks and thread interruption.

885 questions
0
votes
1 answer

C++ boost thread, is the following a legit memory leak?

#include #include #include class callable { public: void operator()() { std::cout << "Thread Run" << std::endl; } } void run() { callable c; boost::thread t(boost::ref(c)); …
roeyc
  • 1
0
votes
1 answer

Program using Boost threads does absolutely nothing

This test code is OK, the problem must be in the way I build it: #include #include void Wait(int seconds) { boost::this_thread::sleep(boost::posix_time::seconds(seconds)); } void Thread() { for (int i = 0; i <…
Pietro
  • 12,086
  • 26
  • 100
  • 193
0
votes
1 answer

Boost message queues between processes that have more than a single thread (boost threads)

I develop an interactive protocol on C++ between N processes that communicate with each other via boost message_queue queues. One of the processes has 2 execution threads, a main thread that uses the queues, and a "helper" thread which listens to…
Edgepo1nt
  • 303
  • 2
  • 13
0
votes
1 answer

Boost library error in Windows 7 64-bit

I have correctly compiled Boost for Windows 8 with VS-10 as given in this link. My project works fine. But when I copy the project to another Windows 7 machine it returns an error message as "The application was unable to start correctly…
Huá dé ní 華得尼
  • 1,248
  • 1
  • 18
  • 33
0
votes
1 answer

Thread Pool compile error

When i try to compile my thread pool with one task i got following error : error: 'void ThreadPool::enqueue(F) [with F = CConnection::handle()::]', declared using local type 'CConnection::handle()::', is used but never defined …
Kacper Fałat
  • 633
  • 3
  • 9
  • 17
0
votes
1 answer

Boost::Thread - thread create issue

I have one problem with my server (based on ASIO & Boost::Thread) In line : this->connection->thread = boost::shared_ptr(new boost::thread(worker, this->connection)); I got error : Core/CCore.cpp: In member function 'void…
Kacper Fałat
  • 633
  • 3
  • 9
  • 17
0
votes
1 answer

Excessive Kernel Launches on Context Creation

Recently I began extending a very boost dependent project to use CUDA for its innermost loop. I thought it would be worth posting here about some odd behaviour I've been seeing though. Simply including certain boost headers will cause my first cuda…
longbowrocks
  • 491
  • 1
  • 5
  • 10
0
votes
1 answer

Boost Async Threading

So I have been using boost as a solution for threading. I seem to be having an issue where the threads I create dont let the main thread that was executing them continue. Eg: int main(){ while(1){ speech listen; //create speech object …
bge0
  • 901
  • 2
  • 10
  • 25
0
votes
1 answer

boost::_bi::unwrapper::unwrap cannot be used as a function?

Was trying to use a thread class I created in Windows, in Linux. Chose Netbeans for it, and in the project settings I've specified Linker > Additional Library Directories as /usr/local/boost_1_53_0 Under Libraries, I specified boost_thread-mt Under…
Nav
  • 19,885
  • 27
  • 92
  • 135
0
votes
1 answer

c++ -std=c++11 -stdlib=libc++ with boost.thread gives Segmentation fault: 11 on OSX

Tried to run some sample code. But something unexpected occured. I wonder is there any known issus about boost.thread used with libc++ together ? Program compiled with -std=c++11 or no option runs well. But when I compiled with -stdlib=libc++ or…
silvesthu
  • 399
  • 3
  • 12
0
votes
1 answer

'CObject::CObject' : cannot access private member declared in class 'CObject'

My problem is: Error 1 error C2248: 'CObject::CObject' : cannot access private member declared in class 'CObject' c:\program files\microsoft visual studio 10.0\vc\atlmfc\include\afxwin.h 1991 1 ProcessInfo And my code: boost::thread…
Alexander Mashin
  • 693
  • 3
  • 14
  • 34
0
votes
1 answer

notify_all causes segmentation fault

I am using boost threads, upon calling notify_all() within the destructor i am seeing a segmentation fault. Here is the stack: (gdb) where #0 0x00007ffff752de84 in pthread_mutex_lock () from /lib/x86_64-linux-gnu/libpthread.so.0 #1 …
godzilla
  • 3,005
  • 7
  • 44
  • 60
0
votes
1 answer

boost::condition_variable with boost::mutex::scoped_lock

Initially I was using boost::mutex::scoped_lock as such (which worked) boost::mutex::scoped_lock lock(mutex_name); condition.wait(lock); //where condition = boost::condition_variable However later I changed the lock to the following which does not…
Rajeshwar
  • 11,179
  • 26
  • 86
  • 158
0
votes
1 answer

boost thread and socket

I have a very weird problem. In server class, if I comment t1.join() I can not read anything from the socket in the HandleFunction. But if I uncomment t1.join(), that works just fine. But I need this listen function run forever and create a thread…
cynric4sure
  • 189
  • 1
  • 12
0
votes
0 answers

Multithreaded logger

I am trying to create a logger for multithreaded c++ code using boost. Here's my code: class logger { private: boost::mutex logMtx; public: logger() { } ~logger() { } void logString(string z) { …
Rohit
  • 371
  • 4
  • 18