Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Source file types.ml
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271(* This file defines the mutually recursive types at the heart of Async. The functions
associated with the types are defined in the corresponding file(s) for each module.
This file should define only types, not functions, since functions defined inside the
recursive modules are not inlined.
If you need to add functionality to a module but doing so would create a dependency
cycle, split the file into pieces as needed to break the cycle, e.g. scheduler0.ml,
scheduler1.ml, scheduler.ml. *)open!Coreopen!ImportmodulerecCell:sigtypeany=[`Empty|`Empty_one_handler|`Empty_one_or_more_handlers|`Full|`Indir]type('a,'b)t=|Empty_one_or_more_handlers:{mutablerun:'a->unit;execution_context:Execution_context.t;mutableprev:'aHandler.t;mutablenext:'aHandler.t}->('a,[>`Empty_one_or_more_handlers])t|Empty_one_handler:('a->unit)*Execution_context.t->('a,[>`Empty_one_handler])t|Empty:('a,[>`Empty])t|Full:'a->('a,[>`Full])t|Indir:'aIvar.t->('a,[>`Indir])tend=CellandHandler:sigtype'at=('a,[`Empty_one_or_more_handlers])Cell.tend=HandlerandIvar:sigtype'at={mutablecell:('a,Cell.any)Cell.t}moduleImmutable:sigtype'at={cell:('a,Cell.any)Cell.t}endend=IvarandDeferred:sigtype+!'atend=DeferredandExecution_context:sigtypet={monitor:Monitor.t;priority:Priority.t;local_storage:Univ_map.t;backtrace_history:Backtrace.tlist}end=Execution_contextandForwarding:sigtypet=|Detached|ParentofMonitor.t|Report_uncaught_exnend=ForwardingandMonitor:sigtypet={name:Info.t;here:Source_code_position.toption;id:int;mutablenext_error:exnIvar.t;mutablehandlers_for_all_errors:(Execution_context.t*(exn->unit))Bag.t;mutabletails_for_all_errors:exnTail.tlist;mutablehas_seen_error:bool;mutableforwarding:Forwarding.t}end=MonitorandTail:sigtype'at={mutablenext:'aStream.nextIvar.t}end=TailandStream:sigtype'at='anextDeferred.tand'anext=|Nil|Consof'a*'atend=Stream(* We avoid using [module rec] to define [Bvar], so that [to_repr] and [of_repr] are
inlined. *)moduleBvar:sigtype('a,-'permission)t(** [repr] exists so that we may hide the implementation of a [Bvar.t], and then add a
phantom type to it upstream. Without this, the phantom type variable would allow
for anything to be coerced in and out, since it is unused. *)type'arepr={mutablehas_any_waiters:bool;mutableivar:'aIvar.t}valof_repr:'arepr->('a,'permission)tvalto_repr:('a,'permission)t->'areprend=structtype'arepr={mutablehas_any_waiters:bool;mutableivar:'aIvar.t}type('a,'permission)t='areprletto_reprt=tletof_reprt=tendmodulerecEvent:sigmoduleStatus:sigtypet=|Fired|Happening_periodic_event|Scheduled|UnscheduledendmoduleOption:sigtypetendtypet={mutablealarm:Job_or_event.tTiming_wheel.Alarm.t;mutableat:Time_ns.t;callback:unit->unit;execution_context:Execution_context.t;mutableinterval:Time_ns.Span.toption;mutablenext_fired:Option.t;mutableprev_fired:Option.t;mutablestatus:Status.t}end=EventandExternal_job:sigtypet=T:Execution_context.t*('a->unit)*'a->tend=External_jobandJob:sigtypeslots=(Execution_context.t,Obj.t->unit,Obj.t)Pool.Slots.t3typet=slotsPool.Pointer.tend=JobandJob_or_event:sigtypetend=Job_or_eventandJob_pool:sigtypet=Job.slotsPool.tend=Job_poolandJob_queue:sigtypet={mutablenum_jobs_run:int;mutablejobs_left_this_cycle:int;mutablejobs:Obj.tUniform_array.t;mutablemask:int;mutablefront:int;mutablelength:int;mutablebacktrace_of_first_enqueue:Backtrace.toption}end=Job_queueandJobs:sigtypet={scheduler:Scheduler.t;mutablejob_pool:Job_pool.t;normal:Job_queue.t;low:Job_queue.t}end=JobsandScheduler:sigtypet={mutablecheck_access:(unit->unit)option;mutablejob_pool:Job_pool.t;normal_priority_jobs:Job_queue.t;low_priority_jobs:Job_queue.t;very_low_priority_workers:Very_low_priority_worker.tDeque.t;mutablemain_execution_context:Execution_context.t;mutablecurrent_execution_context:Execution_context.t;mutableuncaught_exn:(Exn.t*Sexp.t)option;mutablecycle_count:int;mutablecycle_start:Time_ns.t;mutablein_cycle:bool;mutablerun_every_cycle_start:Cycle_hook.tarray;run_every_cycle_start_state:(Cycle_hook_handle.t,Cycle_hook.t)Hashtbl.t;mutablerun_every_cycle_end:Cycle_hook.tarray;run_every_cycle_end_state:(Cycle_hook_handle.t,Cycle_hook.t)Hashtbl.t;mutablelast_cycle_time:Time_ns.Span.t;mutablelast_cycle_num_jobs:int;mutabletotal_cycle_time:Time_ns.Span.t;mutabletime_source:read_writeTime_source.t1;external_jobs:External_job.tThread_safe_queue.t;mutablethread_safe_external_job_hook:unit->unit;mutablejob_queued_hook:(Priority.t->unit)option;mutableevent_added_hook:(Time_ns.t->unit)option;mutableyield:(unit,read_write)Bvar.t;mutableyield_until_no_jobs_remain:(unit,read_write)Bvar.t;mutablecheck_invariants:bool;mutablemax_num_jobs_per_priority_per_cycle:Max_num_jobs_per_priority_per_cycle.t;mutablerecord_backtraces:bool}end=SchedulerandCycle_hook:sigtypet=unit->unitend=Cycle_hookandCycle_hook_handle:Unique_id.Id=Unique_id.Int63()andTime_source_id:Unique_id.Id=Unique_id.Int63()andTime_source:sigtype-'rwt1={id:Time_source_id.t;mutableadvance_errors:Error.tlist;mutableam_advancing:bool;events:Job_or_event.tTiming_wheel.t;mutablefired_events:Event.Option.t;mutablemost_recently_fired:Event.Option.t;handle_fired:Job_or_event.tTiming_wheel.Alarm.t->unit;is_wall_clock:bool;scheduler:Scheduler.t}end=Time_sourceandVery_low_priority_worker:sigmoduleExec_result:sigtypet=|Finished|Not_finishedendtypet={execution_context:Execution_context.t;exec:unit->Exec_result.t}end=Very_low_priority_worker