12 Dec
2002
12 Dec
'02
8:12 p.m.
From: "Duane Murphy"
The problem that I am concerned about is lifetime control. Objects in the main thread could be deleted before the worker thread has a chance to use them. This of course would be a "bad thing."
I am considering investigating the use of weak_ptr as a potential solution to this problem. The basic idea would be to pass weak_ptr's to the worker thread. The worker thread can then check the validity of the weak_ptr before accessing it.
Can weak_ptr be used without using shared_ptr? It seems like they are closely tied. I was hoping to use weak_ptr without forcing the use of shared_ptr.
No, weak_ptr cannot be used without shared_ptr. Why do you need to avoid shared_ptr?