mirror of
https://github.com/deepseek-ai/3FS
synced 2025-06-26 18:16:45 +00:00
Initial commit
This commit is contained in:
20
specs/Timer/LICENSE.txt
Normal file
20
specs/Timer/LICENSE.txt
Normal file
@@ -0,0 +1,20 @@
|
||||
The MIT License
|
||||
|
||||
Copyright (c) 2015 P Developers
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
||||
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
64
specs/Timer/PSrc/Timer.p
Normal file
64
specs/Timer/PSrc/Timer.p
Normal file
@@ -0,0 +1,64 @@
|
||||
/*****************************************************************************************
|
||||
The timer state machine models the non-deterministic behavior of an OS timer
|
||||
******************************************************************************************/
|
||||
machine Timer
|
||||
{
|
||||
// user of the timer
|
||||
var client: machine;
|
||||
start state Init {
|
||||
entry (_client : machine){
|
||||
client = _client;
|
||||
goto WaitForTimerRequests;
|
||||
}
|
||||
}
|
||||
|
||||
state WaitForTimerRequests {
|
||||
on eStartTimer goto TimerStarted;
|
||||
ignore eCancelTimer, eDelayedTimeOut;
|
||||
}
|
||||
|
||||
state TimerStarted {
|
||||
defer eStartTimer;
|
||||
entry {
|
||||
if($)
|
||||
{
|
||||
send client, eTimeOut;
|
||||
goto WaitForTimerRequests;
|
||||
}
|
||||
else
|
||||
{
|
||||
send this, eDelayedTimeOut;
|
||||
}
|
||||
}
|
||||
on eDelayedTimeOut goto TimerStarted;
|
||||
on eCancelTimer goto WaitForTimerRequests;
|
||||
}
|
||||
}
|
||||
|
||||
/************************************************
|
||||
Events used to interact with the timer machine
|
||||
************************************************/
|
||||
event eStartTimer;
|
||||
event eCancelTimer;
|
||||
event eTimeOut;
|
||||
event eDelayedTimeOut;
|
||||
/************************************************
|
||||
Functions or API's to interact with the OS Timer
|
||||
*************************************************/
|
||||
// create timer
|
||||
fun CreateTimer(client: machine) : Timer
|
||||
{
|
||||
return new Timer(client);
|
||||
}
|
||||
|
||||
// start timer
|
||||
fun StartTimer(timer: Timer)
|
||||
{
|
||||
send timer, eStartTimer;
|
||||
}
|
||||
|
||||
// cancel timer
|
||||
fun CancelTimer(timer: Timer)
|
||||
{
|
||||
send timer, eCancelTimer;
|
||||
}
|
||||
2
specs/Timer/PSrc/TimerModules.p
Normal file
2
specs/Timer/PSrc/TimerModules.p
Normal file
@@ -0,0 +1,2 @@
|
||||
/* Create the timer module which consists of only the timer machine */
|
||||
module Timer = { Timer };
|
||||
6
specs/Timer/README.md
Normal file
6
specs/Timer/README.md
Normal file
@@ -0,0 +1,6 @@
|
||||
# Timer
|
||||
|
||||
This project includes modified portions of the following open-source project:
|
||||
|
||||
- [**P**](https://github.com/p-org/P) Licensed under the [MIT License](LICENSE.txt).
|
||||
- Source: the original implementation of [`Timer`](https://github.com/p-org/P/tree/master/Tutorial/Common/Timer).
|
||||
8
specs/Timer/Timer.pproj
Normal file
8
specs/Timer/Timer.pproj
Normal file
@@ -0,0 +1,8 @@
|
||||
<!-- P Project file for the Timer Module-->
|
||||
<Project>
|
||||
<ProjectName>Timer</ProjectName>
|
||||
<InputFiles>
|
||||
<PFile>./PSrc/</PFile>
|
||||
</InputFiles>
|
||||
<OutputDir>./PGenerated/</OutputDir>
|
||||
</Project>
|
||||
Reference in New Issue
Block a user