#include "misc.h"
Go to the source code of this file.
Compounds | |
class | QuartzClass |
Functions | |
void* | QuartzThread ( void* qObj ) |
The Quarz Thread The QuartzThread sends in a specific frequency a specific packet into a specific buffer. More... |
|
The Quarz Thread The QuartzThread sends in a specific frequency a specific packet into a specific buffer.
qObj | the pointer to the object of the QuartzClass |
Definition at line 56 of file quartz.cpp.
00057 { 00058 QuartzClass* myQuartzObject = (QuartzClass*) qObj; 00059 00060 fprintf(stderr,"[qT] Quartz Thread started.. frequency: %d\n",myQuartzObject->getFrequency()); 00061 00062 while (1) 00063 { 00064 #ifdef DEBUGEXTREME 00065 fprintf(stderr,"[qT] %d,%d,%d,%d",myQuartzObject 00066 ,myQuartzObject->getFrequency() 00067 ,myQuartzObject->getRequestPacket() 00068 ,myQuartzObject->getBuf()); 00069 #endif 00070 00071 int test = myQuartzObject->getFrequency(); 00072 00073 if ( !test ) test = 1; 00074 00075 usleep ( (int)( 1000000 / test ) ); 00076 00077 packet* pak; 00078 pak = new packet; 00079 00080 pak->h.header[0] = myQuartzObject->getRequestPacket(); 00081 00082 #ifdef DEBUG 00083 fprintf(stderr,"[asking myQuartzObject(%p)->getBuf()]\n",myQuartzObject); 00084 #endif 00085 00086 Buffer* myqbuf = myQuartzObject->getBuf(); 00087 00088 #ifdef DEBUG 00089 fprintf(stderr,"[attempting to write into buffer (%p)]\n",myqbuf); 00090 #endif 00091 00092 if ( myqbuf ) 00093 myqbuf->write ( pak ); 00094 else 00095 exit(1); 00096 00097 #ifdef DEBUG 00098 fprintf(stderr,"[sending update request successful]\n"); 00099 #endif 00100 } 00101 00102 }