[libss7-commits] mattf: branch mattf/libss7-ss7cluster r279 - /team/mattf/libss7-ss7cluster/

SVN commits to the libss7 project libss7-commits at lists.digium.com
Tue Feb 2 13:57:42 CST 2010


Author: mattf
Date: Tue Feb  2 13:57:40 2010
New Revision: 279

URL: http://svnview.digium.com/svn/libss7?view=rev&rev=279
Log:
Two pthread_mutex_lock calls in a row are not a good thing on non-recursive mutexes :-) 

Modified:
    team/mattf/libss7-ss7cluster/Makefile
    team/mattf/libss7-ss7cluster/isup.c
    team/mattf/libss7-ss7cluster/mtp2.c
    team/mattf/libss7-ss7cluster/ss7.c

Modified: team/mattf/libss7-ss7cluster/Makefile
URL: http://svnview.digium.com/svn/libss7/team/mattf/libss7-ss7cluster/Makefile?view=diff&rev=279&r1=278&r2=279
==============================================================================
--- team/mattf/libss7-ss7cluster/Makefile (original)
+++ team/mattf/libss7-ss7cluster/Makefile Tue Feb  2 13:57:40 2010
@@ -68,7 +68,7 @@
 	gcc -g -o ss7test ss7test.c libss7.a -lpthread
 
 ss7d: ss7d.c $(STATIC_LIBRARY)
-	gcc -g -o ss7d ss7d.c -lpthread -lss7
+	gcc -g -o ss7d ss7d.c libss7.a -lpthread
 
 ss7d-client: ss7d-client.c $(STATIC_LIBRARY)
 	gcc -g -o ss7d-client ss7d-client.c libss7.a -lpthread

Modified: team/mattf/libss7-ss7cluster/isup.c
URL: http://svnview.digium.com/svn/libss7/team/mattf/libss7-ss7cluster/isup.c?view=diff&rev=279&r1=278&r2=279
==============================================================================
--- team/mattf/libss7-ss7cluster/isup.c (original)
+++ team/mattf/libss7-ss7cluster/isup.c Tue Feb  2 13:57:40 2010
@@ -3134,7 +3134,7 @@
 
 	pthread_mutex_lock(&ss7->lock);
 	res = isup_send_message(ss7, &call, ISUP_GRS, greset_params);
-	pthread_mutex_lock(&ss7->lock);
+	pthread_mutex_unlock(&ss7->lock);
 
 	return res;
 }

Modified: team/mattf/libss7-ss7cluster/mtp2.c
URL: http://svnview.digium.com/svn/libss7/team/mattf/libss7-ss7cluster/mtp2.c?view=diff&rev=279&r1=278&r2=279
==============================================================================
--- team/mattf/libss7-ss7cluster/mtp2.c (original)
+++ team/mattf/libss7-ss7cluster/mtp2.c Tue Feb  2 13:57:40 2010
@@ -31,6 +31,8 @@
 
 #include "ss7_internal.h"
 #include "mtp3.h"
+#include <pthread.h>
+#include <signal.h>
 #include <stdio.h>
 #include <string.h>
 #include <unistd.h>
@@ -381,6 +383,9 @@
 		/* Just in case */
 		m->next = NULL;
 	}
+
+	/* Need to break the poll */
+	pthread_kill(link->master->thread, SIGURG);
 
 	return 0;
 }

Modified: team/mattf/libss7-ss7cluster/ss7.c
URL: http://svnview.digium.com/svn/libss7/team/mattf/libss7-ss7cluster/ss7.c?view=diff&rev=279&r1=278&r2=279
==============================================================================
--- team/mattf/libss7-ss7cluster/ss7.c (original)
+++ team/mattf/libss7-ss7cluster/ss7.c Tue Feb  2 13:57:40 2010
@@ -30,6 +30,7 @@
  */
 
 #include <pthread.h>
+#include <signal.h>
 #include <stdlib.h>
 #include <unistd.h>
 #include <stdio.h>
@@ -249,7 +250,8 @@
 			}
 			nextms = tv.tv_sec * 1000;
 			nextms += tv.tv_usec / 1000;
-		}
+		} else
+			nextms = -1;
 
 		polls = 0;
 		if (ss7->needtcpserver) {
@@ -268,16 +270,9 @@
 		pthread_mutex_unlock(&ss7->lock);
 
 		res = poll(poller, polls, nextms);
-		if (res < 0) {
-#if 0
-			printf("next->tv_sec = %d\n", next->tv_sec);
-			printf("next->tv_usec = %d\n", next->tv_usec);
-			printf("tv->tv_sec = %d\n", tv.tv_sec);
-			printf("tv->tv_usec = %d\n", tv.tv_usec);
-#endif
+		if (res < 0 && (errno != EINTR)) {
 			perror("poll");
-		}
-		else if (!res) {
+		} else if (!res) {
 			pthread_mutex_lock(&ss7->lock);
 			ss7_schedule_run(ss7);
 			pthread_mutex_unlock(&ss7->lock);




More information about the libss7-commits mailing list