Re: a POSIX incompliance issue with pthread_mutex_trylock()
Saurabh Desai <[email protected]> Thu, 30 Jan 2003 13:18:25 -0600
| Newsgroups | gmane.linux.ngpt.user |
|---|---|
| Message-ID | <[email protected]> |
Thanks, we will apply this patch. - - - - - Saurabh Desai POSIX Threading for Linux IBM Linux Technology Center e-mail: [email protected] OR [email protected] "Liu, Bing Wei" <[email protected]>@www-124.ibm.com on 01/29/2003 07:59:42 PM Sent by: [email protected] To: [email protected] cc: Subject: [pthreads-users] a POSIX incompliance issue with pthread_mutex_trylock() I am working in the Open POSIX Test Suite project at http://posixtest.sourceforge.net/, whose goal is to perform conformance, functional, stress, and performance testing of POSIX APIs. When running tests upon ngpt-2.2.0, I found an incompliance behavior. If a thread calls pthread_mutex_trylock() on a mutex that it already owns, the function returns EDEADLK. But according to the standards, only pthread_mutex_lock should return EDEADLK, while pthread_mutex_trylock should return EBUSY instead. I am posting a patch which may address this issue. --- ngpt-2.2.0-orig/pth_sync.c 2003-01-30 09:38:57.000000000 +0800 +++ ngpt-2.2.0/pth_sync.c 2003-01-30 09:40:41.000000000 +0800 @@ -273,6 +273,8 @@ return 0; } else { _pth_release(&(mutex->mx_lock), descr->tid); + if(tryonly) + return EBUSY; return EDEADLK; } } @@ -419,6 +421,8 @@ return 0; } else { _pth_release(&(mutex->mx_lock), descr->tid); + if(tryonly) + return EBUSY; return EDEADLK; } } Bingwei Liu Software Engineer, Intel Corporation [email protected] This email message solely contains my own personal views, and not necessarily those of my employer _______________________________________________ pthreads-users mailing list [email protected] http://www-124.ibm.com/developerworks/oss/mailman/listinfo/pthreads-users