Changeset 1006

Show
Ignore:
Timestamp:
04/17/08 13:59:55 (3 months ago)
Author:
luislavena
Message:

mongrel_service: updated ServiceFB library (pistoned).

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  
    1616    '# private (internals) for ServiceProcess.Console() 
    1717    dim shared _svc_stop_signal as any ptr 
     18    dim shared _svc_stop_mutex as any ptr 
     19    dim shared _svc_stopped as BOOL 
    1820    dim shared _svc_in_console as ServiceProcess ptr 
    1921    dim shared _svc_in_console_stop_flag as BOOL 
     
    169171                '# create the signal used to stop the service thread. 
    170172                _svc_stop_signal = condcreate() 
     173                _svc_stop_mutex = mutexcreate() 
    171174                 
    172175                '# register the Console Handler 
     
    190193                        '# create the thread 
    191194                        working_thread = threadcreate(@ServiceProcess.call_onStart, service) 
     195                        if (working_thread = 0) then 
     196                            print "Failed to create working thread." 
     197                        end if 
    192198                    end if 
    193199                     
     
    198204                    '# in case it arrives, the service state must change to exit the 
    199205                    '# 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) 
    201211                     
    202212                    print "Stop signal received, stopping..." 
     
    223233                '# now that service was stopped, destroy the references. 
    224234                conddestroy(_svc_stop_signal) 
    225                  
     235                mutexdestroy(_svc_stop_mutex) 
    226236                print "Done." 
    227237            end if 
     
    288298                    '# now fire the signal 
    289299                    _dprint("fire stop signal") 
     300                    mutexlock(_svc_stop_mutex) 
    290301                    condsignal(_svc_stop_signal) 
    291302                    result = TRUE 
    292303                    _svc_in_console_stop_flag = FALSE 
     304                    _svc_stopped = TRUE 
     305                    mutexunlock(_svc_stop_mutex) 
    293306                     
    294307                case else: 
  • branches/stable_1-2/projects/mongrel_service/lib/ServiceFB/_utils_internals.bi

    r537 r1006  
    4343    '# received. 
    4444    extern _svc_stop_signal as any ptr 
     45    extern _svc_stop_mutex as any ptr 
     46    extern _svc_stopped as BOOL 
    4547    extern _svc_in_console as ServiceProcess ptr 
    4648    extern _svc_in_console_stop_flag as BOOL