Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Timer stops while COMserver is instantiated
Message
De
25/04/2006 13:45:07
 
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Divers
Thread ID:
01116213
Message ID:
01116442
Vues:
16
> But when my VFP app does something and the timer runs pararallely anddoes something else - isn't the timer similar to an extra thread?

No. All events are suspended until application return to idle state.
BTW, multithreading is very deep thing while looks very simple.

Although you cannot use multiple threads, you still can use multiple processes instead and put some long operations to a sattelite (helper) server.
Look at example of such asynchronous server able to process code in script while client stays idle:
BUILD PROJECT Asynchronous FROM (SYS(16))
BUILD EXE Asynchronous FROM Asynchronous 

PUBLIC goClient
m.goClient = CREATEOBJECT("AsyncClient")

m.goClient.StartLongOperation("WAIT TIMEOUT 10")


DEFINE CLASS AsyncClient as Timer
  Helper = Null
  
  FUNCTION Init
    This.Helper = CREATEOBJECT("Asynchronous.Helper")
    This.Helper.ClientObj = This
  ENDFUNC 

  FUNCTION StartLongOperation
    LPARAMETERS cScript
  
    ?"Doing some long operation"
    This.Helper.Script = m.cScript
    
    This.Interval = 1000
  ENDFUNC 
  
  FUNCTION Timer
    ??"."
  ENDFUNC 

  FUNCTION CallBack
    MESSAGEBOX("Operation completed!")
    This.Interval = 0
  ENDFUNC 
ENDDEFINE 



DEFINE CLASS Helper As Timer OLEPUBLIC
  Interval = 1000
  
  ClientObj = Null
  
  Script = ""
  
  FUNCTION Timer
    IF EMPTY(This.Script) THEN 
      RETURN 
    ENDIF 
    
    EXECSCRIPT(This.Script)
    
    This.Script = ""
    This.ClientObj.CallBack()
  ENDFUNC  
ENDDEFINE 
/A new technology turns into completely outdated stuff before you have a time to read "Getting Started..." section.
/If there are some "system programmers" then others are unsystematic.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform