Opened 17 years ago

Closed 17 years ago

#1642 closed bug (fixed)

the posix test pthread_key_delete_2-1 can not terminate normally

Reported by: kaoutsis Owned by: axeld
Priority: normal Milestone: R1
Component: System/libroot.so Version: R1/pre-alpha1
Keywords: Cc:
Blocked By: Blocking:
Platform: All

Description

source file is: src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_key_delete/2-1.c

after some tracing i came to the conclusion that the program control stops inside in the pthread_key_delete:

[...]
void dest_func(void *p)
{
	dest_cnt++;
	/* Delete the key and check if an error has occured */
	if(pthread_key_delete(key) != 0)
	{
		dest_cnt++;
	}
}
[...]

if i comment the if statement, the program terminates.

Another way that i found to make the control to get out of the pthread_key_delete function (leaving the fragment of the code to its original state - no comments) is, while the program is blocked (possibly by the pthread_mutex_lock see pthread_key.c in src/system/libroot/posix/pthread/pthread_key.c) to resize the terminal window a little bit! after that the program terminates successfully :-)

Change History (2)

comment:1 by bonefish, 17 years ago

Our pthread key implementation deadlocks here. It holds a mutex for the key list while calling the key value destructors (when the thread exists) and from the destructor function in the test program the pthread_key_delete() is called, which tries to lock the same mutex.

comment:2 by axeld, 17 years ago

Component: - GeneralSystem/libroot.so
Resolution: fixed
Status: newclosed

Fixed in hrev25000, our pthread key implementation works now lockless.

Note: See TracTickets for help on using tickets.