[netperf-dev] netperf4 commit notice r73 - trunk/src

raj at netperf.org raj at netperf.org
Thu Mar 2 16:25:59 PST 2006


Author: raj
Date: 2006-03-02 16:25:57 -0800 (Thu, 02 Mar 2006)
New Revision: 73

Modified:
   trunk/src/netlib.c
   trunk/src/netlib.h
   trunk/src/netperf.c
   trunk/src/netperf.h
   trunk/src/netserver.c
Log:
Perhaps another half of the way to glib


Modified: trunk/src/netlib.c
===================================================================
--- trunk/src/netlib.c	2006-03-02 23:26:26 UTC (rev 72)
+++ trunk/src/netlib.c	2006-03-03 00:25:57 UTC (rev 73)
@@ -1082,7 +1082,7 @@
    that. raj 2006-03-02 */
 int
 #ifdef WITH_GLIB
-launch_thread(GThread *tid, void *(*start_routine)(void *), void *data)
+launch_thread(GThread **tid, void *(*start_routine)(void *), void *data)
 #else
 launch_thread(pthread_t *tid, void *(*start_routine)(void *), void *data)
 #endif
@@ -1091,7 +1091,7 @@
   int rc;
 
 #ifdef WITH_GLIB
-  NETPERF_THREAD_T *temp_tid;
+  NETPERF_THREAD_T temp_tid;
 
   temp_tid = g_thread_create(start_routine,data,FALSE,NULL);
 

Modified: trunk/src/netlib.h
===================================================================
--- trunk/src/netlib.h	2006-03-02 23:26:26 UTC (rev 72)
+++ trunk/src/netlib.h	2006-03-03 00:25:57 UTC (rev 73)
@@ -97,7 +97,7 @@
 extern int32_t recv_control_message(int control_sock, xmlDocPtr *message);
 extern void report_server_error(server_t *server);
 #ifdef WITH_GLIB
-extern int launch_thread(GThread *tid, void *(*start_routine)(void *), void *data);
+extern int launch_thread(GThread **tid, void *(*start_routine)(void *), void *data);
 #else
 extern int launch_thread(pthread_t *tid, void *(*start_routine)(void *), void *data);
 #endif

Modified: trunk/src/netperf.c
===================================================================
--- trunk/src/netperf.c	2006-03-02 23:26:26 UTC (rev 72)
+++ trunk/src/netperf.c	2006-03-03 00:25:57 UTC (rev 73)
@@ -1009,6 +1009,8 @@
         NETPERF_MUTEX_LOCK(h->hash_lock);
 
 #ifdef WITH_GLIB
+	g_get_current_time(&abstime);
+	g_time_val_add(&abstime,1000);
 	g_cond_timedwait(h->condition, &h->hash_lock, &abstime);
 #else
         get_expiration_time(&delta_time,&abstime);
@@ -1265,10 +1267,10 @@
           fflush(where);
         }
         /* netserver worker thread is not yet initialized start it */
-        rc = launch_thread(&server->tid, netperf_worker, server);
+        rc = launch_thread(&server->thread_id, netperf_worker, server);
         if (debug) {
           fprintf(where,"launched thread %d for netserver %s\n",
-                  server->tid,server->id);
+                  server->thread_id,server->id);
           fflush(where);
         }
         NETPERF_MUTEX_LOCK(h->hash_lock);
@@ -1324,6 +1326,8 @@
         }
         /* test is not yet initialized wait for it */
 #ifdef WITH_GLIB
+	g_get_current_time(&abstime);
+	g_time_val_add(&abstime,1000);
 	g_cond_timedwait(h->condition, &h->hash_lock, &abstime);
 #else
         get_expiration_time(&delta_time,&abstime);
@@ -2164,6 +2168,10 @@
 
   program_name = argv[0];
 
+#ifdef WITH_GLIB
+  g_thread_init(NULL);
+#endif
+
   where = stderr;
 
   decode_switches(argc, argv);

Modified: trunk/src/netperf.h
===================================================================
--- trunk/src/netperf.h	2006-03-02 23:26:26 UTC (rev 72)
+++ trunk/src/netperf.h	2006-03-03 00:25:57 UTC (rev 73)
@@ -44,7 +44,7 @@
 #include <glib.h>
 #define NETPERF_MUTEX_T GMutex
 #define NETPERF_RWLOCK_T GStaticRWLock
-#define NETPERF_THREAD_T GThread
+#define NETPERF_THREAD_T GThread *
 #define NETPERF_COND_T GCond
 #define NETPERF_ABS_TIMESPEC GTimeVal
 #define NETPERF_ABS_TIMESET(base,a,b) base.tv_sec = a;base.tv_usec=b;
@@ -195,7 +195,7 @@
   char            *err_fn;       /* procedure which placed this server into
                                     the NSRV_ERROR state. */
 
-  NETPERF_THREAD_T tid;          /* the posix thread-id of the server
+  NETPERF_THREAD_T thread_id;    /* the posix thread-id of the server
                                     instance within netperf.
                                     Will only be stored in the netperf
                                     process not the netserver process. 

Modified: trunk/src/netserver.c
===================================================================
--- trunk/src/netserver.c	2006-03-02 23:26:26 UTC (rev 72)
+++ trunk/src/netserver.c	2006-03-03 00:25:57 UTC (rev 73)
@@ -395,7 +395,11 @@
           netperf->sock      = sock;
           netperf->state     = NSRV_CONNECTED;
           netperf->state_req = NSRV_WORK;
-          netperf->tid       = -1;
+#ifdef WITH_GLIB
+	  netperf->thread_id       = NULL;
+#else
+          netperf->thread_id       = -1;
+#endif
           netperf->next      = NULL;
 
           /* check the version */
@@ -1028,6 +1032,10 @@
 
   program_name = argv[0];
 
+#ifdef WITH_GLIB
+  g_thread_init(NULL);
+#endif
+
   /* if netserver is invoked with any of the -L, -p or -f options it
      will necessary to setup the listen endpoint.  similarly, if
      standard in is not a socket, it will be necessary to setup the



More information about the netperf-dev mailing list