GNU
|
Liberty Eiffel
|
Automated Tests
|
Wiki
|
Savannah project
|
Debian packages
|
Documentation
>
libraries
>
SIMPLE_PERIODIC_JOB
+
Point of view
LOOP_ITEM
ANY
INTERNALS_HANDLER
TYPED_INTERNALS
JOB
LOOP_ITEM
All features
class SIMPLE_PERIODIC_JOB
Summary
top
Pseudo periodic job. The timing is not exact : the time between two execution may be longer than the given period depending on time needed to execute ready tasks. There is no try to recover the time lost each time.
Direct parents
Inherit list:
PERIODIC_JOB
Class invariant
top
period > 0
Overview
top
Creation features
set_work
(t:
FUNCTION
[
TUPLE
,
BOOLEAN
], tr:
PROCEDURE
[
TUPLE
], prio:
INTEGER_32
, seconds:
REAL_64
)
t has to return True while continue
Exported features
set_work
(t:
FUNCTION
[
TUPLE
,
BOOLEAN
], tr:
PROCEDURE
[
TUPLE
], prio:
INTEGER_32
, seconds:
REAL_64
)
t has to return True while continue
done
:
BOOLEAN
done
returns
True
when the job is finished.
continue
Continue to do the job.
restart
Configure the job like the initial state.
period
:
REAL_64
unit is seconds
next_time
:
MICROSECOND_TIME
prepare
(events:
EVENTS_SET
)
Use
events
to describe condition that make this job ready to
continue
.
is_ready
(events:
EVENTS_SET
):
BOOLEAN
Check if this job is ready to continue his work.
priority
:
INTEGER_32
Never change priority after job inserted in loop_item.
infix "<"
(other:
JOB
):
BOOLEAN
set_work
(t:
FUNCTION
[
TUPLE
,
BOOLEAN
], tr:
PROCEDURE
[
TUPLE
], prio:
INTEGER_32
, seconds:
REAL_64
)
effective procedure
top
t has to return True while continue
require
t /= Void
seconds > 0
ensure
priority
= prio
period
= seconds
done
:
BOOLEAN
writable attribute
top
done
returns
True
when the job is finished.
Then the job may be
restart
(ed) if it need to run again.
continue
effective procedure
top
Continue to do the job.
The work to do has to be small work and non blocking, it will continue on next call.
require
not done
restart
effective procedure
top
Configure the job like the initial state.
Example: when some window dialog appears second time, all jobs from this window are restarted.
require
done
ensure
not done
period
:
REAL_64
writable attribute
top
unit is seconds
next_time
:
MICROSECOND_TIME
writable attribute
top
prepare
(events:
EVENTS_SET
)
effective procedure
top
Use
events
to describe condition that make this job ready to
continue
.
events
describe the conditions to be satisfied before running this job for one more step.
require
events /= Void
not events.queryable
not done
is_ready
(events:
EVENTS_SET
):
BOOLEAN
effective function
top
Check if this job is ready to continue his work.
events
describe the events which occurred.
require
events /= Void
events.queryable
not done
priority
:
INTEGER_32
writable attribute
top
Never change priority after job inserted in loop_item.
Priority should only be set at creation time.
infix "<"
(other:
JOB
):
BOOLEAN
effective function
top