Changeset 8629
- Timestamp:
- 01/30/09 17:28:46 (4 years ago)
- Location:
- ossiedev/branches/0.7.x/components/TxDemo
- Files:
-
- 2 modified
-
TxDemo.cpp (modified) (4 diffs)
-
TxDemo.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
ossiedev/branches/0.7.x/components/TxDemo/TxDemo.cpp
r8363 r8629 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 omni_mutex_lock l(processing_mutex); 69 if (false == thread_started){ 70 thread_started = true; //initialize 71 //Create the thread for the writer's processing function 72 processing_thread = new omni_thread(Run, (void *) this); 73 74 //Start the thread containing the writer's processing function 75 processing_thread->start(); 76 } 76 77 } 77 78 … … 79 80 { 80 81 DEBUG(3, TxDemo, "stop() invoked") 82 omni_mutex_lock l(processing_mutex); 81 83 thread_started=false; 82 84 } … … 131 133 } 132 134 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 } 141 } 142 } 143 135 while(continue_processing()) { 136 // push data to output 137 dataOutPort->pushPacket(I_out, Q_out); 138 139 // wait 140 usleep(packet_delay*1000); 141 } 142 } 143 bool TxDemo_i::continue_processing(void) 144 { 145 omni_mutex_lock l(processing_mutex); 146 return thread_started; 147 } 144 148 145 149 unsigned char data_i[512] = { -
ossiedev/branches/0.7.x/components/TxDemo/TxDemo.h
r8363 r8629 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