python at mrabarnett.plus.com
Sat Mar 20 03:31:23 CET 2010
> I have a common question about locks:
> class SetPointer
> void *ptr;
> MY_LOCK lock;
> void SetPointer(void *p)
> this->ptr = p;
> void *GetPointer()
> 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
1. That's C++. What does it have to do with Python?
2. The value you're accessing is a simple pointer which you're either
setting or getting, so a lock shouldn't be necessary.
3. You're locking, but never unlocking. The sequence should be: lock, do
More information about the Python-list