Hello Rahul

I am on C2D (Core 2 Duo Intel) and your code is working fine on my machine; all threads started and both core had used;


what operating system are You using? linux or windows?

I make a little change; I renamed your class from "shared_mutex" to "shared_mutex1" and same for constructors and destructors.

I was getting redefination of that class. After changing name; every thing is working fine.

?!?!? I'm really surprised with this solution....?!?!?!?
do You mean boost::shared_mutex1 ? but this is not a member of boost.

the point in my problem was that I was invoking stop() for io_service before I reach join.



    io_service.stop();
    thread1.join();
    thread2.join();
    thread3.join();
    thread4.join();

since I commented it :

    //io_service.stop();
    thread1.join();

everything is working fine.

it is logical explanation because io_service.stop() cause stop all threads tied to this io_service.

I dont really know how to explain  that with io_service.stop() this example works fine on your pc. the renaming shared_mutex class is another question for me...

tj





----------------------------------------------------
Jeszcze nigdy żaden thriller nie brzmiał tak pięknie...
"Dziesiata symfonia" już w księgarniach. Musisz to przeczytać.
http://klik.wp.pl/?adr=http://corto.www.wp.pl/as/symfonia.html&sid=634