[prev in list] [next in list] [prev in thread] [next in thread]
List: freebsd-threads
Subject: [Bug 237195] pthread_mutex_unlock crash as unlocked mutex destroyed by signaled thread
From: bugzilla-noreply () freebsd ! org
Date: 2022-08-08 21:34:27
Message-ID: bug-237195-13406-bJSLBwiQPi () https ! bugs ! freebsd ! org/bugzilla/
[Download RAW message or body]
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=237195
--- Comment #13 from longwitz@incore.de ---
OK, thank you for clarification. One bug in my test program was by mistake, an
other for demonstration. With following patch the program works as I have
intended:
--- mypshared.c.orig 2022-08-06 21:13:03.438699000 +0200
+++ mypshared.c 2022-08-08 10:24:26.021928000 +0200
@@ -34,7 +34,7 @@
pthread_mutexattr_t attr, *attrp = NULL;
int rc, first, mycounter;
-int init_only_on_first = 0, always_destroy = 1;
+int init_only_on_first = 0, always_destroy = 0;
pthread_mutex_t magic, *magicp = &magic;
@@ -120,7 +120,7 @@
void
start_mutex() {
- if ( init_only_on_first && first ) {
+ if( !init_only_on_first || first ) {
rc = pthread_mutex_init((pthread_mutex_t *)®ionp->mutexp, attrp);
printf("rc of pthread_mutex_init = %d\n", rc);
if( rc ) exit( rc );
--
You are receiving this mail because:
You are the assignee for the bug.
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic