Changeset 1006
- Timestamp:
- 04/17/08 13:59:55 (3 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/stable_1-2/projects/mongrel_service/lib/ServiceFB
- Property piston:local-revision changed from 582 to 1005
- Property piston:remote-revision changed from 80 to 111
branches/stable_1-2/projects/mongrel_service/lib/ServiceFB/ServiceFB_Utils.bas
r583 r1006 16 16 '# private (internals) for ServiceProcess.Console() 17 17 dim shared _svc_stop_signal as any ptr 18 dim shared _svc_stop_mutex as any ptr 19 dim shared _svc_stopped as BOOL 18 20 dim shared _svc_in_console as ServiceProcess ptr 19 21 dim shared _svc_in_console_stop_flag as BOOL … … 169 171 '# create the signal used to stop the service thread. 170 172 _svc_stop_signal = condcreate() 173 _svc_stop_mutex = mutexcreate() 171 174 172 175 '# register the Console Handler … … 190 193 '# create the thread 191 194 working_thread = threadcreate(@ServiceProcess.call_onStart, service) 195 if (working_thread = 0) then 196 print "Failed to create working thread." 197 end if 192 198 end if 193 199 … … 198 204 '# in case it arrives, the service state must change to exit the 199 205 '# working thread. 200 condwait(_svc_stop_signal) 206 mutexlock(_svc_stop_mutex) 207 do while (_svc_stopped = FALSE) 208 condwait(_svc_stop_signal, _svc_stop_mutex) 209 loop 210 mutexunlock(_svc_stop_mutex) 201 211 202 212 print "Stop signal received, stopping..." … … 223 233 '# now that service was stopped, destroy the references. 224 234 conddestroy(_svc_stop_signal) 225 235 mutexdestroy(_svc_stop_mutex) 226 236 print "Done." 227 237 end if … … 288 298 '# now fire the signal 289 299 _dprint("fire stop signal") 300 mutexlock(_svc_stop_mutex) 290 301 condsignal(_svc_stop_signal) 291 302 result = TRUE 292 303 _svc_in_console_stop_flag = FALSE 304 _svc_stopped = TRUE 305 mutexunlock(_svc_stop_mutex) 293 306 294 307 case else: branches/stable_1-2/projects/mongrel_service/lib/ServiceFB/_utils_internals.bi
r537 r1006 43 43 '# received. 44 44 extern _svc_stop_signal as any ptr 45 extern _svc_stop_mutex as any ptr 46 extern _svc_stopped as BOOL 45 47 extern _svc_in_console as ServiceProcess ptr 46 48 extern _svc_in_console_stop_flag as BOOL
