… | |
… | |
68 | guaranteed to succeed without blocking, until the next coroutine switch |
68 | guaranteed to succeed without blocking, until the next coroutine switch |
69 | (C<cede> etc.). |
69 | (C<cede> etc.). |
70 | |
70 | |
71 | Note that using C<wait> is much less efficient than using C<down>, so try |
71 | Note that using C<wait> is much less efficient than using C<down>, so try |
72 | to prefer C<down> whenever possible. |
72 | to prefer C<down> whenever possible. |
|
|
73 | |
|
|
74 | =item $sem->wait ($callback) |
|
|
75 | |
|
|
76 | If you pass a callback argument to C<wait>, it will not wait, but |
|
|
77 | immediately return. The callback will be called as soon as the semaphore |
|
|
78 | becomes available (which might be instantly), and gets passed the |
|
|
79 | semaphore as first argument. |
|
|
80 | |
|
|
81 | The callback might C<down> the semaphore exactly once, might wake up other |
|
|
82 | coroutines, but is I<NOT> allowed to block (switch to other coroutines). |
|
|
83 | |
|
|
84 | This is considered a rather experimental interface, and is subject to |
|
|
85 | change. |
73 | |
86 | |
74 | =cut |
87 | =cut |
75 | |
88 | |
76 | #=item $status = $sem->timed_down ($timeout) |
89 | #=item $status = $sem->timed_down ($timeout) |
77 | # |
90 | # |