Changeset 8583
- Timestamp:
- 01/17/09 03:43:39 (4 years ago)
- Location:
- ossiedev/trunk/components/TxDemo
- Files:
-
- 2 modified
-
TxDemo.cpp (modified) (4 diffs)
-
TxDemo.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
ossiedev/trunk/components/TxDemo/TxDemo.cpp
r8362 r8583 33 33 // initialize packet delay to be 5 seconds 34 34 packet_delay = 5000; 35 36 //Create the thread for the writer's processing function37 processing_thread = new omni_thread(Run, (void *) this);38 39 //Start the thread containing the writer's processing function40 processing_thread->start();41 42 35 } 43 36 … … 73 66 { 74 67 DEBUG(3, TxDemo, "start() invoked") 75 thread_started=true; 68 thread_started = true; //initialize 69 //Create the thread for the writer's processing function 70 processing_thread = new omni_thread(Run, (void *) this); 71 72 //Start the thread containing the writer's processing function 73 processing_thread->start(); 76 74 } 77 75 … … 79 77 { 80 78 DEBUG(3, TxDemo, "stop() invoked") 79 processing_mutex.lock(); 81 80 thread_started=false; 81 processing_mutex.unlock(); 82 82 } 83 83 … … 131 131 } 132 132 133 while(true) { 134 if (thread_started) { 135 // push data to output 136 dataOutPort->pushPacket(I_out, Q_out); 137 138 // wait 139 usleep(packet_delay*1000); 140 } 133 while(continue_processing()) { 134 // push data to output 135 dataOutPort->pushPacket(I_out, Q_out); 136 137 // wait 138 usleep(packet_delay*1000); 141 139 } 142 140 } 143 141 bool TxDemo_i::continue_processing(void) 142 { 143 bool status; 144 processing_mutex.lock(); 145 status = thread_started; 146 processing_mutex.unlock(); 147 return status; 148 } 144 149 145 150 unsigned char data_i[512] = { -
ossiedev/trunk/components/TxDemo/TxDemo.h
r8362 r8583 85 85 /// Main signal processing method 86 86 void ProcessData(); 87 bool thread_started; 87 bool continue_processing(void); ///< for start - stop processing 88 volatile bool thread_started; 89 omni_mutex processing_mutex; 88 90 89 91 omni_condition *component_running; ///< for component shutdown