Simple lock

moerchendiser2k3 googler.1.webmaster at spamgourmet.com
Sat Mar 20 02:58:28 CET 2010


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



More information about the Python-list mailing list