-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge commit 'c6fb2930db09bc307a740034180b4d2a84bd92b1' into release
- Loading branch information
Showing
20 changed files
with
874 additions
and
601 deletions.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
documentation/examples/VDM++/HomeAutomationConc/BaseThread.vdmpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
class BaseThread | ||
|
||
instance variables | ||
|
||
protected period : nat1 := 1; | ||
protected isPeriodic : bool := true; | ||
|
||
operations | ||
|
||
protected BaseThread : () ==> BaseThread | ||
BaseThread() == | ||
(World`timerRef.RegisterThread(self); | ||
if(not World`timerRef.IsInitialising()) | ||
then start(self); | ||
); | ||
|
||
Step : () ==> () | ||
Step() == | ||
is subclass responsibility | ||
|
||
thread | ||
(if isPeriodic | ||
then (while true | ||
do | ||
(Step(); | ||
World`timerRef.WaitRelative(period); | ||
) | ||
) | ||
else (Step(); | ||
World`timerRef.WaitRelative(0); | ||
World`timerRef.UnRegisterThread(); | ||
) | ||
); | ||
|
||
end BaseThread |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
class BaseThread | ||
|
||
instance variables | ||
|
||
protected period : nat1 := 1; | ||
protected isPeriodic : bool := true; | ||
|
||
operations | ||
|
||
protected BaseThread : () ==> BaseThread | ||
BaseThread() == | ||
(World`timerRef.RegisterThread(self); | ||
if(not World`timerRef.IsInitialising()) | ||
then start(self); | ||
); | ||
|
||
Step : () ==> () | ||
Step() == | ||
is subclass responsibility | ||
|
||
thread | ||
(if isPeriodic | ||
then (while true | ||
do | ||
(Step(); | ||
World`timerRef.WaitRelative(period); | ||
) | ||
) | ||
else (Step(); | ||
World`timerRef.WaitRelative(0); | ||
World`timerRef.UnRegisterThread(); | ||
) | ||
); | ||
|
||
end BaseThread |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.