Main Page | Data Structures | File List | Data Fields | Globals

scheduler.c File Reference

#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#include "command_line_parser.h"
#include "timer.h"
#include "scheduler.h"
#include "socket_comm.h"
#include "global.h"

Include dependency graph for scheduler.c:

Include dependency graph

Go to the source code of this file.

Functions

int scheduler (command_options_t *options)


Function Documentation

int scheduler command_options_t options  ) 
 

Definition at line 54 of file scheduler.c.

References command_options_t, options, periodic_thread(), socket_comm(), timer_struct::timeout, timer_struct::timer_period, and timer_struct_t.

Referenced by main().

00054                                            {
00055   enum {INIT,WAIT,EXECUTE};
00056   static int sch_state=INIT;
00057   static timer_struct_t ts; 
00058   static pthread_t thread;
00059   int ret_val=0;
00060 
00061   switch (sch_state) {
00062   case INIT:
00063     ts.timer_period=TIMER_PERIOD_COUNTS;
00064     ts.timeout=0;
00065     pthread_create(&thread,NULL,periodic_thread,&ts);
00066     sch_state=WAIT;
00067     break;
00068   case WAIT:
00069     if (ts.timeout) {
00070       ts.timeout=0;
00071       sch_state=EXECUTE;
00072     }
00073     break;
00074   case EXECUTE:
00075     socket_comm(options);
00076     sch_state=WAIT;
00077     break;
00078   }
00079   return (ret_val);
00080 }

Here is the call graph for this function:


Generated on Fri Nov 3 15:24:54 2006 for ERT1 Communication Server by  doxygen 1.3.9.1