Re: Shutdown races...

Wilfried Goesgens <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Message-ID <[email protected]>
On Wed, Apr 19, 2006 at 12:37:43PM +0200, Alexander Malysh wrote:
> Hi,
> 
> this patch is also wrong. see below...
> >+        conn = gwlist_get(smsc_list, i);
> >+		smscconn_wait_shutdown_finished(conn);
> 
> I don't know any function with such name...
> 
> >+		info(0,"%li done. %li more to go.", i, j-i);

sorry, forgot that one. 

Wilfried Gösgens
patch_add_wait_shutdown.diff (text/plain, 531 B)
--- a/gateway/gw/smscconn.c	2006-04-18 21:01:30.000000000 +0200
+++ b/gateway/gw/smscconn.c	2006-04-05 18:16:59.000000000 +0200
@@ -289,6 +288,19 @@
 }
 
 
+void smscconn_wait_shutdown_finished(SMSCConn *conn)
+{
+    gw_assert(conn != NULL);
+    mutex_lock(conn->flow_mutex);
+	while (conn->status != SMSCCONN_DEAD) {
+		mutex_unlock(conn->flow_mutex);
+		gwthread_sleep(0.1);
+		mutex_lock(conn->flow_mutex);
+    }
+	mutex_unlock(conn->flow_mutex);
+	return;
+}
+
 void smscconn_shutdown(SMSCConn *conn, int finish_sending)
 {
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.