tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Locking interface in "libprop" implementation



I suppose pa_rwlock & pd_rwlock could be renamed to the rwlock. There is more simple to resolve name disadvantage.

On Wed, May 7, 2008 at 2:51 PM, Matthias Scheler <tron%zhadum.org.uk@localhost> wrote:

       Hello,

the locking primitives in "libprop" are currently used like this:

       _PROP_RWLOCK_RDLOCK(pd->pd_rwlock);
       _PROP_RWLOCK_WRLOCK(pd->pd_rwlock);
       _PROP_RWLOCK_UNLOCK(pd->pd_rwlock);

       _PROP_RWLOCK_RDLOCK(pa->pa_rwlock);
       _PROP_RWLOCK_UNLOCK(pa->pa_rwlock);
       _PROP_RWLOCK_WRLOCK(pa->pa_rwlock);

This interface is IMHO a bit messy because in the case of stand alone
binaries neither "pd_rwlock" nor "pw_rwlock" actually exist. Is there
a reason why the interface doesn't look like this?

       _PROP_RWLOCK_RDLOCK(pd);
       _PROP_RWLOCK_WRLOCK(pd);
       _PROP_RWLOCK_UNLOCK(pd);

       _PROP_RWLOCK_RDLOCK(pa);
       _PROP_RWLOCK_UNLOCK(pa);
       _PROP_RWLOCK_WRLOCK(pa);

The only disadvantage would be that the member containing the lock
would have to use the same name in "_prop_dictionary" and "_prop_array".

       Kind regards

--
Matthias Scheler                                  http://zhadum.org.uk/



--
With Best Regards,
Andy Shevchenko



Home | Main Index | Thread Index | Old Index