Update test programs. All now succeed.
[trust_router.git] / common / tests / thread_test.c
index 0e5aeb4..2cf1438 100644 (file)
@@ -49,7 +49,7 @@ struct thread_data {
   char *label;
 };
 
-TR_MQ_MSG *make_msg(label, n)
+static TR_MQ_MSG *make_msg(char *label, int n)
 {
   TR_MQ_MSG *msg=NULL;
   msg=tr_mq_msg_new(NULL, "Message", TR_MQ_PRIO_NORMAL);
@@ -58,12 +58,12 @@ TR_MQ_MSG *make_msg(label, n)
   return msg;
 }
 
-void *thread_start(void *arg)
+static void *thread_start(void *arg)
 {
   TR_MQ *mq=((struct thread_data *)arg)->mq;
   int n_msgs=((struct thread_data *)arg)->n_msgs;
   useconds_t msg_dly=((struct thread_data *)arg)->msg_dly;
-  const char *label=((struct thread_data *)arg)->label;
+  char *label=((struct thread_data *)arg)->label;
   
   while (n_msgs>=0) {
     usleep(msg_dly);
@@ -80,7 +80,7 @@ struct message_data {
   int ready;
 };
 
-void handle_messages(TR_MQ *mq, void *arg)
+static void handle_messages(TR_MQ *mq, void *arg)
 {
   struct message_data *status=(struct message_data *)arg;
   pthread_mutex_lock(&(status->lock));
@@ -89,12 +89,12 @@ void handle_messages(TR_MQ *mq, void *arg)
   pthread_mutex_unlock(&(status->lock));
 }
 
-void output_messages(TR_MQ *mq)
+static void output_messages(TR_MQ *mq)
 {
   TR_MQ_MSG *msg=NULL;
 
   printf("\n* handle_messages notified of new messages in queue.\n");
-  for (msg=tr_mq_pop(mq); msg!=NULL; msg=tr_mq_pop(mq)) {
+  for (msg=tr_mq_pop(mq, NULL); msg!=NULL; msg=tr_mq_pop(mq, NULL)) {
     printf("  > %s\n", (char *)msg->p);
     tr_mq_msg_free(msg);
   }
@@ -153,5 +153,6 @@ int main(void)
   for (ii=0; ii<N_THREADS; ii++)
     pthread_join(thread[ii], NULL);
 
+  printf("success\n");
   return 0;
 }