Matthew Dillon wrote:
    That said, from an administrative point of view I want to have maximum
    compatibility between libthread_xu and libpthread, because we aren't
    really in the business of policing other people's work.

    So I am willing to commit the change, even if the standard doesn't allow
    NULL.

The standard says:

int pthread_mutex_lock(pthread_mutex_t *mutex);
int pthread_mutex_trylock(pthread_mutex_t *mutex);
int pthread_mutex_unlock(pthread_mutex_t *mutex);

Note that none of the parameters has the modifier "restricted". That means that they may be NULL.

The pthread_mutex_lock(), pthread_mutex_trylock(), and pthread_mutex_unlock() functions may fail if:

[EINVAL]
The value specified by mutex does not refer to an initialized mutex object.

Now, of course we cannot detect every single value that might not refer to an initialized mutex object (unless we caught exceptions, etc.), but returning EINVAL on a NULL pointer for sure isn't the wrong thing to do.

cheers
  simon

--
Serve - BSD     +++  RENT this banner advert  +++    ASCII Ribbon   /"\
Work - Mac      +++  space for low €€€ NOW!1  +++      Campaign     \ /
Party Enjoy Relax   |   http://dragonflybsd.org      Against  HTML   \
Dude 2c 2 the max   !   http://golden-apple.biz       Mail + News   / \

Reply via email to