|
Previous Top Next |
Prototype: | (Long pMaxRun) |
pMaxRun | Maximum number of instances that can be active at the same time. |
This method is used to set the MaxRuns property, which controls how many instances of the procedure can be active at the same time. The template generate the call to this method into the WindowManager.Run method at priority 1 so it is the very first code that is executed when the procedure is run.
Example:
ITThreadLocal Class(ITThreadLimitClass)
TakeLimit Procedure,VIRTUAL
End
ThisWindow.Run PROCEDURE
Code
ITThreadLocal.Init('Browsepeople')
ITThreadLocal.SetProcedureLimit(5)
If Not ITThreadLocal.CheckProcedure(ITThreadLimit)
Return LEVEL:Fatal
End
ReturnValue = PARENT.Run()
RETURN ReturnValue
ThisWindow.Init PROCEDURE
Code
If Not ITThreadLocal.AddProcedure(QuickWindow)
Return LEVEL:Fatal
End
In this case up to 5 different threads with the "BrowsePeople" procedure could be active at the same time. When the 6th instance is started the AddProcedure will return False indicating that the MaxRun limit has been reached.
See also: