On Fri, Jan 8, 2010 at 22:05, David Xu <davi...@freebsd.org> wrote: > #define TYPE_SIMPLE_WAIT 0 > -#define TYPE_CV 1 > -#define TYPE_SIMPLE_LOCK 2 > -#define TYPE_NORMAL_UMUTEX 3 > -#define TYPE_PI_UMUTEX 4 > -#define TYPE_PP_UMUTEX 5 > -#define TYPE_RWLOCK 6 > +#define TYPE_CV (TYPE_SIMPLE_WAIT+1) > +#define TYPE_SEM (TYPE_CV+1) > +#define TYPE_SIMPLE_LOCK (TYPE_SEM+1) > +#define TYPE_NORMAL_UMUTEX (TYPE_SIMPLE_LOCK+1) > +#define TYPE_PI_UMUTEX (TYPE_NORMAL_UMUTEX+1) > +#define TYPE_PP_UMUTEX (TYPE_PI_UMUTEX+1) > +#define TYPE_RWLOCK (TYPE_PP_UMUTEX+1) >
I am not sure I get the benefit of defining them this way. Certainly it does nothing to improve stability in the face of additions, removals or re-sorting (in the latter case, it makes figuring out how to define a new one exceptionally hard.) I am not aware of a trend towards defining constants this way in the kernel (there are none in sys/ that I see) and find it kind of baffling and needlessly obtuse. If there is a need to define them in such an unusual manner, it would be nice to see a comment that says why. If you don't need to use #defines and have a dislike assigning numbers by hand, why not simply use 'enum'? _______________________________________________ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"