Boost logo

Boost Users :

Subject: Re: [Boost-users] Questions about packaged_task , Promise and serialization of a class object and event handling
From: Master (master.huricane_at_[hidden])
Date: 2012-04-15 22:29:21


 Thank you all very much
and sorry for anything wrong i have done :( .
ok talking about threads ,how can i query a thread object to see if it
points to a valid thread of execution ? will just comparing it with null!
do it ? i mean specially after using join() or detach() on them ( i dont
know if that was necessary!)

question two : when i detach a thread, do i really loose it for good ? cant
i have any access of any kind to it ? any kind of management ? checking it
? suppose my detached thread was to run a function named "somefunc()", will
i access the thread in there ? i mean can i have any kind of management in
that thread ? by management i mean get its id for example in case to
differentiate it from other possible detached! or joined? threads running
that specific function , and possibly do sth to the share resource that
detached thread of mine were to work on , or simply change the owner ( for
example create a new thread, move the ownership form the detached one to
his new one , and then make it joinable !, may be this doesnt make sense ,
i just want to know if these kind of stuff are do able )

how detached threads of any use ?
do i have to immediately write thread.join() in order for my thread to join
with the main thread ? or i can do it at any place in my source code ? what
about detaching it ? does it make any difference?

do we have any means in pausing /resuming a thread ? rather than using the
e.g windows api ?
i mean suppose i have a thread thats done 90% of its work and suddenly and
event is triggered and for some unknown duration , it needs to get paused ,
and then when the criteria is met , get resumed again ,
i cant simply delete that thread, because maybe it has done so much
calculation on and its not a wise action to through everything and start
over ! again because time is not specific , cant use sleep to block it for
some time ,
so how should we do it ?

is there a sample showing the use of sharedmemory with threading ? i
already checked the interprocess section , there were two simple samples
which didnt have any threading in it !

how would i want to use pointers in a multi threaded application ? i mean
do i even need one of those smart pointers ? if i do, would you name some
of scenarios that might need the use of smart pointers? i would be
grateful

again thank you :)



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