Howdy, I'm planning to use Boost.Thread in my program to utilize concurrency. I already had a closer look at the documentation and I noticed that it's lacking most parts for which I would consult a documentation in the first place: 1. API reference 2. A user guide showing how to use Boost.Thread in practical examples The only code examples I spotted were pseudo-code which were pretty meaningless to me. For example: void foo() { create_thread(&bar); } What is create_thread? Which arguments does it take? What is bar? I know I can't demand anything from the author since it's free software, but... this is simply not very helpful. So, does anyone know a good source with examples and maybe even an API reference of Boost.Thread? Thanks in advance. -- Matthias Kaeppler
Matthias Kaeppler wrote:
Howdy,
I'm planning to use Boost.Thread in my program to utilize concurrency. I already had a closer look at the documentation and I noticed that it's lacking most parts for which I would consult a documentation in the first place:
1. API reference
I agree the documentation of Boost.Thread might be a little difficult to
navigate. Personally I preferred the documentation in 1_31_0 much better but
everything is there, you just have to search...
API reference:
Go to http://www.boost.org/doc/html/threads.html and see the "Reference"
section. For example, clicking on the "Header
2. A user guide showing how to use Boost.Thread in practical examples
Most boost libraries come with examples and even the ones that don't come with tests (which in a way are examples of usage). For Boost.Thread go to your boost installation and look inside libs/thread/example. There is also a libs/thread/tutorial directory full of goodies. The documentation page also provides examples. The "Concepts" page tells you how to use boost::mutex and locks. The "Rationale" section the same.
The only code examples I spotted were pseudo-code which were pretty meaningless to me.
For example:
void foo() { create_thread(&bar); }
What is create_thread? Which arguments does it take? What is bar?
This is not precisely pseudo-code but some parts have been omitted. I believe the purpose of that code is to illustrate use patterns. create_thread is a method of thread_group which you use to create a thread and bar is a functor for your thread proc.
I know I can't demand anything from the author since it's free software, but... this is simply not very helpful. So, does anyone know a good source with examples and maybe even an API reference of Boost.Thread?
Hope that helps. -delfin
I found very useful this article from the library's author http://www.cuj.com/documents/s=8470/cuj0205kempf/ there are simple explanation on how the library work and very clear sample code. oh! pay attention that when you build a thread object, the copy costructor of the passed function object is copy-costructed! I've had some problems with that _ see my post of few days ago ;-) bye, ricky Matthias Kaeppler wrote:
Delfin Rojas wrote:
Hope that helps.
Yes! Thanks a ton. I think I found everything now to take a good start.
Best regards, Matthias
participants (3)
-
Delfin Rojas
-
Matthias Kaeppler
-
Ricky Corsi