RE: POSIX compliance: pthread_mutex_destroy()

"Howell, David P" <[email protected]> Wed, 26 Feb 2003 06:57:18 -0800
Newsgroups gmane.linux.ngpt.user
Message-ID <[email protected]>
The attached patch to the pristine ngpt-2.2.0 fixes this. Apply it to
the 
clean ngpt-2.2.0 tarball, rerun ./configure, and rebuild to resolve it.

Regards,
Dave Howell

These are my opinions and not official opinions of Intel Corp.

David Howell
Intel Corporation
Telco Server Development
Server Products Division
Voice: (803) 461-6112  Fax: (803) 461-6292

Intel Corporation
Columbia Design Center, CBA-2
250 Berryhill Road, Suite 100
Columbia, SC 29210

[email protected]


-----Original Message-----
From: Selbak, Rolla N 
Sent: Monday, February 24, 2003 6:06 PM
To: '[email protected]'
Subject: [pthreads-users] POSIX compliance: pthread_mutex_destroy()

hello,

I am working on the Open POSIX Test Suite project at
http://posixtest.sourceforge.net
I ran the POSIX compliance tests upon 

ngpt-2.2.0
kernel-2.4.18
glibc-2.2.93-5

There seemed to be an error in the function pthread_mutex_destroy(),
where
the test failed because pthread_mutex_destroy() did not successfully
destroy
a mutex initialized using PTHREAD_MUTEX_INITIALIZER, it instead returned
EINVAL (22).

The test that I am using to reproduce this issue is part of the POSIX
Test
Suite project http://posixtest.sourceforge.net under
posixtestsuite/conformance/interfaces/pthread_mutex_destroy/1-1.c
(pasted
the code below)

Error message received was: "Fail to destroy mutex3, rc=22"

thanks,

Rolla Selbak

* my views are not necessarily my employer's *

test 1-1.c for pthread_mutex_destroy()
---------------------------------------

/*   
 * Copyright (c) 2002, Intel Corporation. All rights reserved.
 * Created by:  bing.wei.liu REMOVE-THIS AT intel DOT com
 * This file is licensed under the GPL license.  For the full content
 * of this license, see the COPYING file at the top level of this 
 * source tree.

 * Test that pthread_mutex_destroy()
 *   shall destroy the mutex referenced by 'mutex'; the mutex object in
effect
 *   becomes uninitialized. 
 *
 */

#include <pthread.h>
#include <stdio.h>
#include "posixtest.h"

pthread_mutex_t  mutex1, mutex2;
pthread_mutex_t  mutex3 = PTHREAD_MUTEX_INITIALIZER;

int main()
{
	pthread_mutexattr_t mta;
	int rc;

	/* Initialize a mutex attributes object */
	if((rc=pthread_mutexattr_init(&mta)) != 0) {
		fprintf(stderr,"Error at pthread_mutexattr_init(),
rc=%d\n",rc);
		return PTS_UNRESOLVED;
	}
	
	/* Initialize mutex1 with the default mutex attributes */
	if((rc=pthread_mutex_init(&mutex1,&mta)) != 0) {
		fprintf(stderr,"Fail to initialize mutex1, rc=%d\n",rc);
		return PTS_UNRESOLVED;
	}

	/* Initialize mutex2 with NULL attributes */
	if((rc=pthread_mutex_init(&mutex2,NULL)) != 0) {
		fprintf(stderr,"Fail to initialize mutex2, rc=%d\n",rc);
		return PTS_UNRESOLVED;
	}

	/* Destroy the mutex attributes object */
	if((rc=pthread_mutexattr_destroy(&mta)) != 0) {
		fprintf(stderr,"Error at pthread_mutexattr_destroy(),
rc=%d\n",rc);
		return PTS_UNRESOLVED;
	}

	/* Destroy mutex1 */
	if((rc=pthread_mutex_destroy(&mutex1)) != 0) {
		fprintf(stderr,"Fail to destroy mutex1, rc=%d\n",rc);
		printf("Test FAILED\n");
		return PTS_FAIL;
	}

	/* Destroy mutex2 */
	if((rc=pthread_mutex_destroy(&mutex2)) != 0) {
		fprintf(stderr,"Fail to destroy mutex2, rc=%d\n",rc);
		printf("Test FAILED\n");
		return PTS_FAIL;
	}

	/* Destroy mutex3 */
	if((rc=pthread_mutex_destroy(&mutex3)) != 0) {
		fprintf(stderr,"Fail to destroy mutex3, rc=%d\n",rc);
		printf("Test FAILED\n");
		return PTS_FAIL;
	}

	printf("Test PASSED\n");
	return PTS_PASS;
}
_______________________________________________
pthreads-users mailing list
[email protected]
http://www-124.ibm.com/developerworks/oss/mailman/listinfo/pthreads-user
s
patch-ngpt-2.2.0-mutex (application/octet-stream, 3.5 KB) - not displayed