Simple lock

M

moerchendiser2k3

Hi,
I have a common question about locks:
class SetPointer
{
private:
void *ptr;
MY_LOCK lock;
public:
void SetPointer(void *p)
{
Lock(this->lock);
this->ptr = p;
}
void *GetPointer()
{
Lock(this->lock);
return this->ptr;
}
};

Just a question, is this lock redundant, when the Pointer can be set/
get from different threads?
Thanks a lot!! Bye, moerchendiser2k3
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,285
Latest member
CryptoTaxxSoftware

Latest Threads

Top