package frama-c
Install
dune-project
Dependency
Authors
-
MMichele Alberti
-
TThibaud Antignac
-
GGergö Barany
-
PPatrick Baudin
-
TThibaut Benjamin
-
AAllan Blanchard
-
LLionel Blatter
-
FFrançois Bobot
-
RRichard Bonichon
-
QQuentin Bouillaguet
-
DDavid Bühler
-
ZZakaria Chihani
-
LLoïc Correnson
-
JJulien Crétin
-
PPascal Cuoq
-
ZZaynah Dargaye
-
BBasile Desloges
-
JJean-Christophe Filliâtre
-
PPhilippe Herrmann
-
MMaxime Jacquemin
-
FFlorent Kirchner
-
AAlexander Kogtenkov
-
TTristan Le Gall
-
JJean-Christophe Léchenet
-
MMatthieu Lemerre
-
DDara Ly
-
DDavid Maison
-
CClaude Marché
-
AAndré Maroneze
-
TThibault Martin
-
FFonenantsoa Maurica
-
MMelody Méaulle
-
BBenjamin Monate
-
YYannick Moy
-
PPierre Nigron
-
AAnne Pacalet
-
VValentin Perrelle
-
GGuillaume Petiot
-
DDario Pinto
-
VVirgile Prevosto
-
AArmand Puccetti
-
FFélix Ridoux
-
VVirgile Robles
-
JJan Rochel
-
MMuriel Roger
-
JJulien Signoles
-
NNicolas Stouls
-
KKostyantyn Vorobyov
-
BBoris Yakobowski
Maintainers
Sources
sha256=0c80dae8074fcb3f6a33d7a41faf9939a2a336478a8d2c79e20e2d7bab953735
doc/frama-c.kernel/Frama_c_kernel/Task/index.html
Module Frama_c_kernel.Task
High Level Interface to Command.
Task
val pretty :
(Format.formatter -> 'a -> unit) ->
Format.formatter ->
'a status ->
unitMonadic Constructors
val nop : unit taskThe task that immediately returns unit
val return : 'a -> 'a taskThe task that immediately returns a result
val raised : exn -> 'a taskThe task that immediately fails with an exception
val canceled : unit -> 'a taskThe task that is immediately canceled
val failed : ('a, Format.formatter, unit, 'b task) format4 -> 'aThe task that immediately fails by raising a Failure exception. Typically: [let exit d : 'a task = failed "exit status %d" k]
val call : ?canceled:('a -> unit) -> ('a -> 'b) -> 'a -> 'b taskThe task that, when started, invokes a function and immediately returns the result.
The task that, when started, compute a task to continue with.
bind t k first runs t. Then, when t exit with status s, it starts task k s.
<b>Remark:</b> If t was cancelled, k s is still evaluated, but immediately canceled as well. This allows finally-like behaviors to be implemented. To evaluate k r only when t terminates normally, make use of the sequence operator.
sequence t k first runs t. If t terminates with Result r, then task k r is started. Otherwise, failure or cancelation of t is returned.
finally t cb runs task t and always calls cb s when t exits with status s. Then s is returned. If the callback cb raises an exception, the returned status is emitted.
Same as finally but the status of the task is discarded.
low level command for managing ressource with active wait
Synchronous Command
val mutex : unit -> mutexSchedules a task such that only one can run simultaneously for a given mutex.
System Command
val command :
?timeout:float ->
?time:float ref ->
?stdout:Buffer.t ->
?stderr:Buffer.t ->
string ->
string array ->
int taskImmediately launch a system-process. Default timeout is 0, which means no-timeout at all. Standard outputs are discarded unless optional buffers are provided. To make the task start later, simply use todo (command ...).
Shared Tasks
When two tasks A and B share a common sub-task S, cancelling A will make B fail either. To prevent this, it is necessary to make S shareable and to use two distinct instances of S in A and B.
Shared tasks manage the number of their instance and actually run or cancel a unique task on demand. In particular, shared tasks can be canceled and re-started later.
Shareable tasks.
Build a shareable task. The build function is called whenever a new instance is required but no shared instance task is actually running. Interrupted tasks (by Cancel or Timeout) are retried for further instances. If the task failed, it can be re-launch if retry is true. Otherwise, further instances will return Failed status.
New instance of shared task.
Task Thread
val cancel : thread -> unitval progress : thread -> boolMake the thread progress and return true if still running
val is_running : thread -> boolDon't make the thread progress, just returns true if not terminated or not started yet
val run : thread -> unitRuns one single task in the background. Typically using on_idle.
Task Pool
val pool : unit -> poolval flush : pool -> unitClean all terminated tasks
val size : pool -> intAuto-flush. Number of living tasks
Task Server
val server : ?stages:int -> ?procs:int -> unit -> serverCreates a server of commands.
Schedules a task on the server. The task is not immediately started.
val launch : server -> unitStarts the server if not running yet
val cancel_all : server -> unitCancel all scheduled tasks
val get_procs : server -> intMaximum number of running process
val set_procs : server -> int -> unitAdjusts the maximum number of running process.
val on_server_activity : server -> (unit -> unit) -> unitIdle server callback
val on_server_start : server -> (unit -> unit) -> unitOn-start server callback
val on_server_stop : server -> (unit -> unit) -> unitOn-stop server callback
val on_server_wait : server -> (unit -> unit) -> unitOn-wait server callback (all tasks are scheduled)
val terminated : server -> intNumber of terminated process
val remaining : server -> intNumber of remaining process
val scheduled : server -> intTotal number of scheduled process
val running : server -> intNumber of active process
val waiting : server -> int optionAll task scheduled and server is waiting for termination
GUI Configuration
val on_idle : ((unit -> bool) -> unit) refTypically modified by GUI. !on_idle f should repeatedly calls f until it returns false. Default implementation rely on Unix.sleep 1 and Db.progress. See also Gtk_helper module implementation.