Boost logo

Boost Users :

Subject: Re: [Boost-users] [Thread] (Newb) shared memory in multithread process
From: gabe_rosser (gabriel.rosser_at_[hidden])
Date: 2009-07-10 07:17:20


Anthony Williams-4 wrote:
>
> gabe_rosser <gabriel.rosser_at_[hidden]> writes:
>
>> Now I have an error from main() (also shown in bold
>> above):
>>
>> main.cpp:123: error: variable ‘boost::thread t1’ has initialiser but
>> incomplete type
>> main.cpp:124: error: variable ‘boost::thread t2’ has initialiser but
>> incomplete type
>>
>> Sorry but I'm not sure how to fix this.
>
> There's a missing include:
>
> #include <boost/thread/thread.hpp>
>
> Anthony
> --
> Author of C++ Concurrency in Action | http://www.manning.com/williams
> just::thread C++0x thread library | http://www.stdthread.co.uk
> Just Software Solutions Ltd |
> http://www.justsoftwaresolutions.co.uk
> 15 Carrallack Mews, St Just, Cornwall, TR19 7UL, UK. Company No. 5478976
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>

Perfect, sorry - I should have spotted that one (was too baffled by the code
to start with the simple things!).

The simple example above is around 10% slower when run multithreaded
compared with a single thread (optimized). This is substantially better
than my previous attempts! If reader_thread() were more complex then I
guess we would expect an increase in efficiency compared with a single
thread.

Thanks very much Anthony and Steven for your help.

Gabe

-- 
View this message in context: http://www.nabble.com/-Thread--%28Newb%29-shared-memory-in-multithread-process-tp24409906p24425603.html
Sent from the Boost - Users mailing list archive at Nabble.com.

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net