Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Clarion ThreadMonitor class - used to Notify a thread as each thread starts and ends
MEMBER
MAP
END
INCLUDE('ThreadMonitor.inc'),ONCE
eqDBG EQUATE('<4,2,7>')
MOD:ConstructEvent SIGNED
MOD:DestructEvent SIGNED
MOD:ThreadToInform SIGNED
!ThreadMonitor.InitOnce PROCEDURE(SIGNED xConstructEvent, SIGNED xDestructEvent, ThreadType xThreadToInform)
! CODE
! MOD:ConstructEvent = xConstructEvent
! MOD:DestructEvent = xDestructEvent
! MOD:ThreadToInform = xThreadToInform
ThreadMonitor.ConstructEvent PROCEDURE(SIGNED xNewValue)
CODE
MOD:ConstructEvent = xNewValue
ThreadMonitor.ConstructEvent PROCEDURE()!,SIGNED
CODE
RETURN MOD:ConstructEvent
ThreadMonitor.DestructEvent PROCEDURE(SIGNED xNewValue)
CODE
MOD:DestructEvent = xNewValue
ThreadMonitor.DestructEvent PROCEDURE()!,SIGNED
CODE
RETURN MOD:DestructEvent
ThreadMonitor.ThreadToInform PROCEDURE(SIGNED xNewValue)
CODE
MOD:ThreadToInform = xNewValue
ThreadMonitor.ThreadToInform PROCEDURE()!,SIGNED
CODE
RETURN MOD:ThreadToInform
ThreadMonitor.CONSTRUCT PROCEDURE
CODE
!Assert(0,eqDBG&'ThreadMonitor.CONTRUCT THREAD()['& THREAD() &'] Mod:ConstructEvent['& Mod:ConstructEvent &'] Mod:ThreadToInform['& Mod:ThreadToInform &']')
IF Mod:ConstructEvent AND Mod:ThreadToInform
NOTIFY(Mod:ConstructEvent, Mod:ThreadToInform, THREAD() )
END
ThreadMonitor.DESTRUCT PROCEDURE
CODE
!Assert(0,eqDBG&'ThreadMonitor.DESTRUCT THREAD()['& THREAD() &'] Mod:DestructEvent['& Mod:DestructEvent &'] Mod:ThreadToInform['& Mod:ThreadToInform &']')
IF Mod:DestructEvent AND Mod:ThreadToInform
NOTIFY(Mod:DestructEvent, Mod:ThreadToInform, THREAD() )
END
ThreadMonitor CLASS,THREAD,MODULE('ThreadMonitor.clw'),LINK('ThreadMonitor.clw') ! <--- INSTANCE CLASS, that is THREADed
ConstructEvent PROCEDURE(SIGNED xNewValue)
ConstructEvent PROCEDURE(),SIGNED
DestructEvent PROCEDURE(SIGNED xNewValue)
DestructEvent PROCEDURE(),SIGNED
ThreadToInform PROCEDURE(SIGNED xNewValue)
ThreadToInform PROCEDURE(),SIGNED
CONSTRUCT PROCEDURE
DESTRUCT PROCEDURE
END
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.