Diff for /libaitsched/example/test.c between versions 1.1.2.1 and 1.1.2.2

version 1.1.2.1, 2011/08/12 23:06:55 version 1.1.2.2, 2011/08/13 17:17:08
Line 1 Line 1
 #include <stdio.h>  #include <stdio.h>
   #include <unistd.h>
   #include <fcntl.h>
   #include <sys/types.h>
   #include <sys/stat.h>
   #include <sys/socket.h>
   #include <netinet/in.h>
 #include <aitsched.h>  #include <aitsched.h>
   
 void *event(void *arg)  void *event(void *arg)
 {  {
           printf("Event::\n");
         return NULL;          return NULL;
 }  }
   
   void *eventlo(void *arg)
   {
           printf("EventLOW::\n");
           return NULL;
   }
   
   void *timer(void *arg)
   {
           printf("Timer 10sec::\n");
           return NULL;
   }
   
   void *r(void *arg)
   {
           printf("read::\n");
           return NULL;
   }
   
   void *w(void *arg)
   {
           printf("write::\n");
           return NULL;
   }
   
   void *once(void *arg)
   {
           printf("once::\n");
           return NULL;
   }
   
 int  int
 main(int argc, char **argv)  main(int argc, char **argv)
 {  {
         sched_root_task_t *root;          sched_root_task_t *root;
           int f;
           struct sockaddr_in sin;
   
           f = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
           if (f == -1)
                   return 1;
           sin.sin_len = sizeof sin;
           sin.sin_family = AF_INET;
           sin.sin_port = htons(2345);
           sin.sin_addr.s_addr = INADDR_ANY;
           if (bind(f, (struct sockaddr*) &sin, sizeof sin) == -1)
                   return 1;
   
         root = schedBegin();          root = schedBegin();
         if (!root) {          if (!root) {
                 printf("Error:: #%d - %s\n", sched_GetErrno(), sched_GetError());                  printf("Error:: #%d - %s\n", sched_GetErrno(), sched_GetError());
Line 22  main(int argc, char **argv) Line 71  main(int argc, char **argv)
                 return 2;                  return 2;
         }          }
   
           if (!schedEventLo(root, eventlo, "piuk", 1111)) {
                   printf("Error:: #%d - %s\n", sched_GetErrno(), sched_GetError());
                   return 3;
           }
   
           if (!schedTimer(root, timer, "blah", 10000000)) {
                   printf("Error:: #%d - %s\n", sched_GetErrno(), sched_GetError());
                   return 4;
           }
   
           if (!schedRead(root, r, "rrr", f)) {
                   printf("Error:: #%d - %s\n", sched_GetErrno(), sched_GetError());
                   return 5;
           }
   
           if (!schedWrite(root, w, "www", f)) {
                   printf("Error:: #%d - %s\n", sched_GetErrno(), sched_GetError());
                   return 6;
           }
   
           schedCallOnce(root, once, "000000", 42);
   
           schedRun(root);
         schedEnd(root);          schedEnd(root);
   
           close(f);
         return 0;          return 0;
 }  }

Removed from v.1.1.2.1  
changed lines
  Added in v.1.1.2.2


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>