Dear Rick,

Im talking about the mutex test Erich asked me yesterday to compile and run on 
the Android Device.
https://android.googlesource.com/platform/system/extras/+/froyo/tests/bionic/libc/bionic/test_mutex.c

Thats the codeblock where the error occured in test_mutex.c:


/* error-check mutex */

    expect( pthread_mutexattr_settype( &attr, PTHREAD_MUTEX_ERRORCHECK ), 0 );

    expect( pthread_mutex_init( &lock, &attr ), 0 );

    expect( pthread_mutex_lock( &lock ), 0 );

    expect( pthread_mutex_lock( &lock ), EDEADLK );

    expect( pthread_mutex_unlock( &lock ), 0 );

    expect( pthread_mutex_trylock( &lock ), 0 );

    expect( pthread_mutex_trylock( &lock ), EDEADLK ); /*Changed to EBUSY here*/

    expect( pthread_mutex_unlock( &lock ), 0 );

    expect( pthread_mutex_unlock( &lock ), EPERM );

    expect( pthread_mutex_destroy( &lock ), 0 );


The line with the comment

/*Changed to EBUSY here*/

is the line in question. A line above pthread_mutex_trylock locks the mutex and 
in the next line (bold) tries to lock again. The expected value is “EDEADLK 
(35)” which is wrong if I understand correctly because trylock should return 
“EBUSY (16)” instead of “EDEADLK”.

If I understand the program correctly, its task is to return an error here but 
16 and not 35. So I changed “EDEADLK” to “EBUSY”.
So the change seems reasonable to me.

Maybe I did not understand your answer correctly?

Best regards
Thomas

On 7/6/21 12:52 PM, Rick McGuire wrote:

That is not a good fix. This should not be returning an error at all, since 
this is just a nested request for the semaphore. There's still something wrong 
going on with the recursive semaphores.

Rick

On Tue, Jul 6, 2021 at 6:46 AM Thomas Kahr 
<tho...@vaime.at<mailto:tho...@vaime.at>> wrote:
Hi all,

below is an update on the mutex test.

It works perfectly. The problem was in the code it seems. According to the 
POSIX standard pthread_mutex_trylock should return errorcode 16 (EBUSY) if the 
mutex is already locked. But the expectation value in the mutex test is given 
with EDEADLK (Errorcode 35) as showed in my mail from yesterday. So after I 
changed the expectation value to EBUSY everything works as hoped. 16 is 
expected and returned.

Best regards
Thomas


On 7/5/21 9:25 PM, Rick McGuire wrote:
And so many other things will fail if that line is removed.

Rick

On Mon, Jul 5, 2021 at 3:18 PM Thomas Kahr 
<tho...@vaime.at<mailto:tho...@vaime.at>> wrote:

Additional Info to the mutex test:

Without the line:

expect( pthread_mutex_trylock( &lock ), EDEADLK );


The program runs fine and I get an "OK". So everything works except this one 
line.

Best regards

Thomas


On 7/5/21 6:34 PM, Erich Steinböck wrote:

problems getting the configuration for the semaphores to work correctly
There really aren't a lot of configuration options any more.  I just recently 
cleaned up the SysSempahore code with revision 12259.
And I now believe that we cannot run at all without both 
pthread_mutexattr_settype and PTHREAD_MUTEX_RECURSIVE so I might as well remove 
that option too (all of our platforms that we currently run builds on have 
support for those.)

Thomas, are you at revision 12259 or later?  If not can you please update?

The last time you reported the CMake status of the various pthread 
functionality, you showed some "failed"
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_mutexattr_settype
-- Looking for pthread_mutexattr_settype - not found
-- Looking for pthread_mutex_timedlock
-- Looking for pthread_mutex_timedlock - not found
-- Performing Test HAVE_PTHREAD_MUTEX_ERRORCHECK
-- Performing Test HAVE_PTHREAD_MUTEX_ERRORCHECK - Failed
-- Performing Test HAVE_PTHREAD_MUTEX_RECURSIVE
-- Performing Test HAVE_PTHREAD_MUTEX_RECURSIVE - Failed
What's the current status?

To test the actual mutex functionality on Android, can you compile and run this 
test?
https://android.googlesource.com/platform/system/extras/+/froyo/tests/bionic/libc/bionic/test_mutex.c
Please also test whether " #define __USE_UNIX98 1" is required to successfully 
compile/run.




_______________________________________________
Oorexx-devel mailing list
Oorexx-devel@lists.sourceforge.net<mailto:Oorexx-devel@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/oorexx-devel


​
_______________________________________________
Oorexx-devel mailing list
Oorexx-devel@lists.sourceforge.net<mailto:Oorexx-devel@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/oorexx-devel




_______________________________________________
Oorexx-devel mailing list
Oorexx-devel@lists.sourceforge.net<mailto:Oorexx-devel@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/oorexx-devel



_______________________________________________
Oorexx-devel mailing list
Oorexx-devel@lists.sourceforge.net<mailto:Oorexx-devel@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/oorexx-devel




_______________________________________________
Oorexx-devel mailing list
Oorexx-devel@lists.sourceforge.net<mailto:Oorexx-devel@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/oorexx-devel
_______________________________________________
Oorexx-devel mailing list
Oorexx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oorexx-devel

Reply via email to