5
5
"""
6
6
Condition()
7
7
8
- Create an edge-triggered event source that tasks can wait for. Tasks that call `wait` on a
9
- `Condition` are suspended and queued. Tasks are woken up when `notify` is later called on
10
- the `Condition`. Edge triggering means that only tasks waiting at the time `notify` is
8
+ Create an edge-triggered event source that tasks can wait for. Tasks that call [ `wait`](:func:`wait`) on a
9
+ `Condition` are suspended and queued. Tasks are woken up when [ `notify`](:func:`notify`) is later called on
10
+ the `Condition`. Edge triggering means that only tasks waiting at the time [ `notify`](:func:`notify`) is
11
11
called can be woken up. For level-triggered notifications, you must keep extra state to keep
12
12
track of whether a notification has happened. The [`Channel`](:class:`Channel`) type does
13
13
this, and so can be used for level-triggered events.
@@ -60,7 +60,7 @@ n_waiters(c::Condition) = length(c.waitq)
60
60
"""
61
61
@schedule
62
62
63
- Wrap an expression in a `Task` and add it to the local machine's scheduler queue.
63
+ Wrap an expression in a [ `Task`](:obj:`Task`) and add it to the local machine's scheduler queue.
64
64
"""
65
65
macro schedule (expr)
66
66
expr = :(()-> ($ expr))
@@ -84,11 +84,11 @@ schedule(t::Task) = enq_work(t)
84
84
"""
85
85
schedule(t::Task, [val]; error=false)
86
86
87
- Add a task to the scheduler's queue. This causes the task to run constantly when the system
88
- is otherwise idle, unless the task performs a blocking operation such as `wait`.
87
+ Add a [`Task`](:obj:`Task`) to the scheduler's queue. This causes the task to run constantly when the system
88
+ is otherwise idle, unless the task performs a blocking operation such as [ `wait`](:func:`wait`) .
89
89
90
90
If a second argument `val` is provided, it will be passed to the task (via the return value of
91
- `yieldto`) when it runs again. If `error` is `true`, the value is raised as an exception in
91
+ [ `yieldto`](:func:`yieldto`) ) when it runs again. If `error` is `true`, the value is raised as an exception in
92
92
the woken task.
93
93
"""
94
94
function schedule (t:: Task , arg; error= false )
@@ -124,7 +124,7 @@ tasks.
124
124
yield () = (enq_work (current_task ()); wait ())
125
125
126
126
"""
127
- yieldto(task , arg = nothing)
127
+ yieldto(t::Task , arg = nothing)
128
128
129
129
Switch to the given task. The first time a task is switched to, the task's function is
130
130
called with no arguments. On subsequent switches, `arg` is returned from the task's last
@@ -203,10 +203,11 @@ end
203
203
"""
204
204
AsyncCondition()
205
205
206
- Create a async condition that wakes up tasks waiting for it (by calling `wait` on the object)
207
- when notified from C by a call to uv_async_send.
208
- Waiting tasks are woken with an error when the object is closed (by `close`).
209
- Use `isopen` to check whether it is still active.
206
+ Create a async condition that wakes up tasks waiting for it
207
+ (by calling [`wait`](:func:`wait`) on the object)
208
+ when notified from C by a call to `uv_async_send`.
209
+ Waiting tasks are woken with an error when the object is closed (by [`close`](:func:`close`).
210
+ Use [`isopen`](:func:`isopen`) to check whether it is still active.
210
211
"""
211
212
type AsyncCondition
212
213
handle:: Ptr{Void}
277
278
"""
278
279
Timer(delay, repeat=0)
279
280
280
- Create a timer that wakes up tasks waiting for it (by calling `wait` on the timer object) at
281
+ Create a timer that wakes up tasks waiting for it (by calling [ `wait`](:func:`wait`) on the timer object) at
281
282
a specified interval. Times are in seconds. Waiting tasks are woken with an error when the
282
- timer is closed (by `close`). Use `isopen` to check whether a timer is still active.
283
+ timer is closed (by [ `close`](:func:`close` ). Use [ `isopen`](:func:`isopen`) to check whether a timer is still active.
283
284
"""
284
285
type Timer
285
286
handle:: Ptr{Void}
@@ -367,7 +368,7 @@ Create a timer to call the given `callback` function. The `callback` is passed o
367
368
the timer object itself. The callback will be invoked after the specified initial `delay`,
368
369
and then repeating with the given `repeat` interval. If `repeat` is `0`, the timer is only
369
370
triggered once. Times are in seconds. A timer is stopped and has its resources freed by
370
- calling `close` on it.
371
+ calling [ `close`](:func:`close`) on it.
371
372
"""
372
373
function Timer (cb:: Function , timeout:: Real , repeat:: Real = 0.0 )
373
374
t = Timer (timeout, repeat)
0 commit comments