|
Lines 120-128
Link Here
|
| 120 |
.Ft int |
120 |
.Ft int |
| 121 |
.Fn evSetIdleTimer "evContext opaqueCtx" "evTimerFunc func" "void *uap" \ |
121 |
.Fn evSetIdleTimer "evContext opaqueCtx" "evTimerFunc func" "void *uap" \ |
| 122 |
"struct timespec max_idle" "evTimerID *opaqueID" |
122 |
"struct timespec max_idle" "evTimerID *opaqueID" |
| 123 |
.Ft int |
123 |
.Ft int |
| 124 |
.Fn evTouchIdleTimer "evContext opaqueCtx" "evTimerID id" |
124 |
.Fn evTouchIdleTimer "evContext opaqueCtx" "evTimerID id" |
| 125 |
.Ft int |
125 |
.Ft int |
| 126 |
.Fn evResetIdleTimer "evContext opaqueCtx" "evTimerID id" "evTimerFunc func" \ |
126 |
.Fn evResetIdleTimer "evContext opaqueCtx" "evTimerID id" "evTimerFunc func" \ |
| 127 |
"void *uap" "struct timespec max_idle" |
127 |
"void *uap" "struct timespec max_idle" |
| 128 |
.Ft int |
128 |
.Ft int |
|
Lines 196-202
Link Here
|
| 196 |
.Fn evCreate |
196 |
.Fn evCreate |
| 197 |
creates an event context which is needed by all the other functions in this |
197 |
creates an event context which is needed by all the other functions in this |
| 198 |
library. All information used internally by this library is bound to this |
198 |
library. All information used internally by this library is bound to this |
| 199 |
context, rather than to static storage. This makes the library |
199 |
context, rather than to static storage. This makes the library |
| 200 |
.Dq thread safe , |
200 |
.Dq thread safe , |
| 201 |
and permits other library functions to use events without |
201 |
and permits other library functions to use events without |
| 202 |
disrupting the application's use of events. |
202 |
disrupting the application's use of events. |
|
Lines 236-249
Link Here
|
| 236 |
.Fa EV_NULL , |
236 |
.Fa EV_NULL , |
| 237 |
which tells |
237 |
which tells |
| 238 |
.Fn evGetNext |
238 |
.Fn evGetNext |
| 239 |
that it should return a special |
239 |
that it should return a special |
| 240 |
.Dq no-op |
240 |
.Dq no-op |
| 241 |
event, which is ignored by |
241 |
event, which is ignored by |
| 242 |
.Fn evDispatch |
242 |
.Fn evDispatch |
| 243 |
but handled correctly by |
243 |
but handled correctly by |
| 244 |
.Fn evDrop . |
244 |
.Fn evDrop . |
| 245 |
.Fa EV_NULL |
245 |
.Fa EV_NULL |
| 246 |
can be necessary to the correct functioning of a caller\-written equivilent to |
246 |
can be necessary to the correct functioning of a caller\-written equivalent to |
| 247 |
.Fn evMainLoop , |
247 |
.Fn evMainLoop , |
| 248 |
wherein perterbations caused by external system events must be polled for, and |
248 |
wherein perterbations caused by external system events must be polled for, and |
| 249 |
the default behaviour of internally ignoring such events is undesirable. |
249 |
the default behaviour of internally ignoring such events is undesirable. |
|
Lines 309-318
Link Here
|
| 309 |
The functions |
309 |
The functions |
| 310 |
.Fn evTimeSpec |
310 |
.Fn evTimeSpec |
| 311 |
and |
311 |
and |
| 312 |
.Fn evTimeVal |
312 |
.Fn evTimeVal |
| 313 |
are utilities which allow the caller to convert a |
313 |
are utilities which allow the caller to convert a |
| 314 |
.Dq Fa struct timeval |
314 |
.Dq Fa struct timeval |
| 315 |
to a |
315 |
to a |
| 316 |
.Dq Fa struct timespec |
316 |
.Dq Fa struct timespec |
| 317 |
(the function of |
317 |
(the function of |
| 318 |
.Fn evTimeSpec ) |
318 |
.Fn evTimeSpec ) |
|
Lines 359-374
Link Here
|
| 359 |
.Xr gettimeofday 2 . ) |
359 |
.Xr gettimeofday 2 . ) |
| 360 |
.Pp |
360 |
.Pp |
| 361 |
The function |
361 |
The function |
| 362 |
.Fn evLastEventTime |
362 |
.Fn evLastEventTime |
| 363 |
returns the |
363 |
returns the |
| 364 |
.Dq Fa struct timespec |
364 |
.Dq Fa struct timespec |
| 365 |
which describes the last time that certain events happened to the |
365 |
which describes the last time that certain events happened to the |
| 366 |
event context indicated by |
366 |
event context indicated by |
| 367 |
.Fa opaqueCtx . |
367 |
.Fa opaqueCtx . |
| 368 |
This value is updated by |
368 |
This value is updated by |
| 369 |
.Fn evCreate |
369 |
.Fn evCreate |
| 370 |
and |
370 |
and |
| 371 |
.Fn evGetNext |
371 |
.Fn evGetNext |
| 372 |
(upon entry and after |
372 |
(upon entry and after |
| 373 |
.Xr select 2 |
373 |
.Xr select 2 |
| 374 |
returns); it is routinely compared with other times in the internal handling |
374 |
returns); it is routinely compared with other times in the internal handling |
|
Lines 391-408
Link Here
|
| 391 |
.Fa due |
391 |
.Fa due |
| 392 |
argument equal to |
392 |
argument equal to |
| 393 |
.Dq Fn evConsTime 0 0 |
393 |
.Dq Fn evConsTime 0 0 |
| 394 |
means |
394 |
means |
| 395 |
.Dq due immediately . |
395 |
.Dq due immediately . |
| 396 |
The |
396 |
The |
| 397 |
.Fa opaqueID |
397 |
.Fa opaqueID |
| 398 |
argument, if specified as a value other than |
398 |
argument, if specified as a value other than |
| 399 |
.Fa NULL , |
399 |
.Fa NULL , |
| 400 |
will be used to store the resulting |
400 |
will be used to store the resulting |
| 401 |
.Dq timer \s-1ID\s+1 , |
401 |
.Dq timer \s-1ID\s+1 , |
| 402 |
useful as an argument to |
402 |
useful as an argument to |
| 403 |
.Fn evClearTimer . |
403 |
.Fn evClearTimer . |
| 404 |
Note that in a |
404 |
Note that in a |
| 405 |
.Dq one\-shot |
405 |
.Dq one\-shot |
| 406 |
timer (which has an |
406 |
timer (which has an |
| 407 |
.Fa inter |
407 |
.Fa inter |
| 408 |
argument equal to |
408 |
argument equal to |
|
Lines 438-444
Link Here
|
| 438 |
will exist within the event library. |
438 |
will exist within the event library. |
| 439 |
.Pp |
439 |
.Pp |
| 440 |
The function |
440 |
The function |
| 441 |
.Fn evSetIdleTimer |
441 |
.Fn evSetIdleTimer |
| 442 |
is similar to (and built on) |
442 |
is similar to (and built on) |
| 443 |
.Fn evSetTimer ; |
443 |
.Fn evSetTimer ; |
| 444 |
it registers an idle timer event which provides for the function call to |
444 |
it registers an idle timer event which provides for the function call to |
|
Lines 450-473
Link Here
|
| 450 |
time has passed since the time the idle timer was |
450 |
time has passed since the time the idle timer was |
| 451 |
.Dq last touched ; |
451 |
.Dq last touched ; |
| 452 |
originally, this is set to the time returned by |
452 |
originally, this is set to the time returned by |
| 453 |
.Fn evLastEventTime |
453 |
.Fn evLastEventTime |
| 454 |
(described above) for the event context specified by |
454 |
(described above) for the event context specified by |
| 455 |
.Fa opaqueCtx . |
455 |
.Fa opaqueCtx . |
| 456 |
This is a |
456 |
This is a |
| 457 |
.Dq one\-shot |
457 |
.Dq one\-shot |
| 458 |
timer, but the time at which the |
458 |
timer, but the time at which the |
| 459 |
.Fa func |
459 |
.Fa func |
| 460 |
is actually called can be changed by recourse to |
460 |
is actually called can be changed by recourse to |
| 461 |
.Fn evTouchIdleTimer |
461 |
.Fn evTouchIdleTimer |
| 462 |
(described below). The pointer to the underlying |
462 |
(described below). The pointer to the underlying |
| 463 |
.Dq timer \s-1ID\s+1 |
463 |
.Dq timer \s-1ID\s+1 |
| 464 |
is returned in |
464 |
is returned in |
| 465 |
.Fa opaqueID , |
465 |
.Fa opaqueID , |
| 466 |
if it is |
466 |
if it is |
| 467 |
.No non- Ns Dv NULL . |
467 |
.No non- Ns Dv NULL . |
| 468 |
.Pp |
468 |
.Pp |
| 469 |
The |
469 |
The |
| 470 |
.Fn evTouchIdleTimer |
470 |
.Fn evTouchIdleTimer |
| 471 |
function updates the idle timer associated with |
471 |
function updates the idle timer associated with |
| 472 |
.Fa id , |
472 |
.Fa id , |
| 473 |
setting its idea of the time it was last accessed to the value returned by |
473 |
setting its idea of the time it was last accessed to the value returned by |
|
Lines 496-502
Link Here
|
| 496 |
function unregisters the idle timer associated with |
496 |
function unregisters the idle timer associated with |
| 497 |
.Fa id . |
497 |
.Fa id . |
| 498 |
See the discussion under |
498 |
See the discussion under |
| 499 |
.Fn evClearTimer , |
499 |
.Fn evClearTimer , |
| 500 |
above, for information regarding caller handling of the |
500 |
above, for information regarding caller handling of the |
| 501 |
.Fa uap |
501 |
.Fa uap |
| 502 |
associated with the corresponding |
502 |
associated with the corresponding |
|
Lines 510-529
Link Here
|
| 510 |
on the given event context's wait queue with the associated (possibly |
510 |
on the given event context's wait queue with the associated (possibly |
| 511 |
.Dv NULL ) |
511 |
.Dv NULL ) |
| 512 |
.Dq Fa tag ; |
512 |
.Dq Fa tag ; |
| 513 |
if |
513 |
if |
| 514 |
.Fa id |
514 |
.Fa id |
| 515 |
is |
515 |
is |
| 516 |
.No non- Ns Dv NULL , |
516 |
.No non- Ns Dv NULL , |
| 517 |
then it will contain the |
517 |
then it will contain the |
| 518 |
.Dq wait \s-1ID\s+1 |
518 |
.Dq wait \s-1ID\s+1 |
| 519 |
associated with the created queue element. |
519 |
associated with the created queue element. |
| 520 |
.Pp |
520 |
.Pp |
| 521 |
The function |
521 |
The function |
| 522 |
.Fn evDo |
522 |
.Fn evDo |
| 523 |
marks |
523 |
marks |
| 524 |
.Em all |
524 |
.Em all |
| 525 |
of the |
525 |
of the |
| 526 |
.Dq waiting |
526 |
.Dq waiting |
| 527 |
functions in the given event context's wait queue with the associated (possibly |
527 |
functions in the given event context's wait queue with the associated (possibly |
| 528 |
.Dv NULL ) |
528 |
.Dv NULL ) |
| 529 |
.Dq Fa tag |
529 |
.Dq Fa tag |
|
Lines 533-544
Link Here
|
| 533 |
.Fn evGetNext . |
533 |
.Fn evGetNext . |
| 534 |
.Pp |
534 |
.Pp |
| 535 |
The function |
535 |
The function |
| 536 |
.Fn evUnwait |
536 |
.Fn evUnwait |
| 537 |
will search for the |
537 |
will search for the |
| 538 |
.Dq wait \s-1ID\s+1 |
538 |
.Dq wait \s-1ID\s+1 |
| 539 |
.Fa id |
539 |
.Fa id |
| 540 |
in the wait queue of the given event context; if an element with the given |
540 |
in the wait queue of the given event context; if an element with the given |
| 541 |
.Fa id |
541 |
.Fa id |
| 542 |
is not found, then the |
542 |
is not found, then the |
| 543 |
.Dq done |
543 |
.Dq done |
| 544 |
queue of that context is searched. If found, the queue element is removed |
544 |
queue of that context is searched. If found, the queue element is removed |
|
Lines 660-668
Link Here
|
| 660 |
.Pp |
660 |
.Pp |
| 661 |
The function |
661 |
The function |
| 662 |
.Fn evTimeRW |
662 |
.Fn evTimeRW |
| 663 |
sets the stream associated with the given stream \s-1ID\s+1 |
663 |
sets the stream associated with the given stream \s-1ID\s+1 |
| 664 |
.Dq Fa id |
664 |
.Dq Fa id |
| 665 |
to have the idle timer associated with the timer \s-1ID\s+1 |
665 |
to have the idle timer associated with the timer \s-1ID\s+1 |
| 666 |
.Dq Fa timer . |
666 |
.Dq Fa timer . |
| 667 |
.Pp |
667 |
.Pp |
| 668 |
The function |
668 |
The function |
|
Lines 721-727
Link Here
|
| 721 |
.Fn \*(lp*func\*(rp |
721 |
.Fn \*(lp*func\*(rp |
| 722 |
will be |
722 |
will be |
| 723 |
.Fa -1 |
723 |
.Fa -1 |
| 724 |
if an error occurred that prevented this connection from completing |
724 |
if an error occurred that prevented this connection from completing |
| 725 |
successfully. In this case |
725 |
successfully. In this case |
| 726 |
.Fn errno |
726 |
.Fn errno |
| 727 |
will have been set and the socket described by |
727 |
will have been set and the socket described by |
|
Lines 777-789
Link Here
|
| 777 |
.Pp |
777 |
.Pp |
| 778 |
The function |
778 |
The function |
| 779 |
.Fn evInitID |
779 |
.Fn evInitID |
| 780 |
will initialize an opaque |
780 |
will initialize an opaque |
| 781 |
.Dq evConn \s-1ID\s+1 , |
781 |
.Dq evConn \s-1ID\s+1 , |
| 782 |
.Dq evFile \s-1ID\s+1 , |
782 |
.Dq evFile \s-1ID\s+1 , |
| 783 |
.Dq evStream \s-1ID\s+1 , |
783 |
.Dq evStream \s-1ID\s+1 , |
| 784 |
.Dq evTimer \s-1ID\s+1 , |
784 |
.Dq evTimer \s-1ID\s+1 , |
| 785 |
.Dq evWait \s-1ID\s+1 , |
785 |
.Dq evWait \s-1ID\s+1 , |
| 786 |
.Dq evContext , |
786 |
.Dq evContext , |
| 787 |
or |
787 |
or |
| 788 |
.Dq evEvent , |
788 |
.Dq evEvent , |
| 789 |
which is passed by reference. |
789 |
which is passed by reference. |
|
Lines 804-812
Link Here
|
| 804 |
to indicate failure. |
804 |
to indicate failure. |
| 805 |
.Sh FILE |
805 |
.Sh FILE |
| 806 |
.Pa heap.h , |
806 |
.Pa heap.h , |
| 807 |
which is in the |
807 |
which is in the |
| 808 |
.Pa src/lib/isc |
808 |
.Pa src/lib/isc |
| 809 |
directory of the current |
809 |
directory of the current |
| 810 |
.Sy BIND |
810 |
.Sy BIND |
| 811 |
distribution. |
811 |
distribution. |
| 812 |
.Sh ERRORS |
812 |
.Sh ERRORS |
|
Lines 825-832
Link Here
|
| 825 |
.Fa FD_SETSIZE , |
825 |
.Fa FD_SETSIZE , |
| 826 |
meaning that the application's limit is higher than the library's. |
826 |
meaning that the application's limit is higher than the library's. |
| 827 |
.It Bq Er ENOENT |
827 |
.It Bq Er ENOENT |
| 828 |
The specified |
828 |
The specified |
| 829 |
.Dq event \s-1ID\s+1 |
829 |
.Dq event \s-1ID\s+1 |
| 830 |
does not exist. |
830 |
does not exist. |
| 831 |
.It Bq Er EWOULDBLOCK |
831 |
.It Bq Er EWOULDBLOCK |
| 832 |
No events have occurred and the |
832 |
No events have occurred and the |