Date: Tue, 09 Dec 2003 10:45:40 +0900 From: Alexander Nedotsukov <bland@FreeBSD.org> To: threads@FreeBSD.org Subject: typo in my last post Message-ID: <3FD52944.40007@FreeBSD.org>
index | next in thread | raw e-mail
[-- Attachment #1 --] Please read thr_mutex.c:mutex_lock_common() as thr_mutex.c:mutex_unlock_common(). I also think it will be good to add this: http://www.opengroup.org/onlinepubs/007904975/functions/pthread_mutex_lock.html Here is a quote: ERRORS ... [EPERM] The current thread does not own the mutex. ... Wich is similar to our: ... [EPERM] The current thread does not hold a lock on mutex. ... And this is what actually happen when mutex just intialized or unlocked. It's vaild but simply owned by no one therefore not by current thread. What I trying to say that current behaviour looks like: ... [EPERM] Mutex hold by another thread. ... See also proposed patch attached. Thanks, Alexander. [-- Attachment #2 --] cvs server: Diffing . Index: thr_mutex.c =================================================================== RCS file: /home/ncvs/src/lib/libpthread/thread/thr_mutex.c,v retrieving revision 1.44 diff -u -r1.44 thr_mutex.c --- thr_mutex.c 9 Dec 2003 00:52:28 -0000 1.44 +++ thr_mutex.c 9 Dec 2003 01:40:21 -0000 @@ -1001,11 +1001,8 @@ * mutex: */ if ((*m)->m_owner != curthread) - /* - * Return an invalid argument error for no - * owner and a permission error otherwise: - */ - ret = (*m)->m_owner == NULL ? EINVAL : EPERM; + /* We're not own this one */ + ret = EPERM; else if (((*m)->m_type == PTHREAD_MUTEX_RECURSIVE) && ((*m)->m_count > 0)) @@ -1039,11 +1036,8 @@ * mutex: */ if ((*m)->m_owner != curthread) - /* - * Return an invalid argument error for no - * owner and a permission error otherwise: - */ - ret = (*m)->m_owner == NULL ? EINVAL : EPERM; + /* We're not own this one */ + ret = EPERM; else if (((*m)->m_type == PTHREAD_MUTEX_RECURSIVE) && ((*m)->m_count > 0)) @@ -1096,11 +1090,8 @@ * mutex: */ if ((*m)->m_owner != curthread) - /* - * Return an invalid argument error for no - * owner and a permission error otherwise: - */ - ret = (*m)->m_owner == NULL ? EINVAL : EPERM; + /* We're not own this one */ + ret = EPERM; else if (((*m)->m_type == PTHREAD_MUTEX_RECURSIVE) && ((*m)->m_count > 0))help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3FD52944.40007>
