- document selnotify.

- add ref. to knote(9).
This commit is contained in:
yamt 2004-02-18 13:35:46 +00:00
parent 912c7e4549
commit d448296d2d
2 changed files with 36 additions and 19 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.155 2004/02/14 00:00:56 hannken Exp $
# $NetBSD: Makefile,v 1.156 2004/02/18 13:35:46 yamt Exp $
# Makefile for section 9 (kernel function and variable) manual pages.
@ -403,7 +403,8 @@ MLINKS+=SCHED_LOCK.9 SCHED_UNLOCK.9 \
SCHED_LOCK.9 sched_lock_idle.9 \
SCHED_LOCK.9 sched_unlock_idle.9
MAN+= selrecord.9
MLINKS+=selrecord.9 selwakeup.9
MLINKS+=selrecord.9 selwakeup.9 \
selrecord.9 selnotify.9
MLINKS+=setjmp.9 longjmp.9
MLINKS+=setrunqueue.9 remrunqueue.9 \
setrunqueue.9 nextrunqueue.9

View File

@ -1,4 +1,4 @@
.\" $NetBSD: selrecord.9,v 1.2 2003/11/16 16:17:13 wiz Exp $
.\" $NetBSD: selrecord.9,v 1.3 2004/02/18 13:35:46 yamt Exp $
.\"
.\" Copyright (C) 2002 Chad David <davidc@acns.ab.ca>. All rights reserved.
.\"
@ -28,13 +28,13 @@
.\" $FreeBSD: src/share/man/man9/selrecord.9,v 1.2 2002/05/30 13:29:17 ru Exp $
.\"
.\" FreeBSD: .Dd March 20, 2002
.Dd November 16, 2003
.Dd February 18, 2004
.Dt SELRECORD 9
.Os
.Sh NAME
.Nm selrecord ,
.Nm selwakeup
.Nd record and wakeup select requests
.Nd "record and wakeup select requests"
.Sh SYNOPSIS
.In sys/param.h
.In sys/select.h
@ -42,30 +42,32 @@
.Fn selrecord "struct proc *selector" "struct selinfo *sip"
.Ft void
.Fn selwakeup "struct selinfo *sip"
.Ft void
.Fn selnotify "struct selinfo *sip" "long knhint"
.Sh DESCRIPTION
.Fn selrecord
and
.Fn selwakeup
are the two central functions used by
.Xr select 2 ,
.Xr poll 2 ,
.Xr poll 2
and the objects that are being selected on.
They handle the task of recording which threads are waiting on
which objects and the waking of the proper threads when an event
of interest occurs on an object.
They handle the task of recording which threads are waiting on which objects
and the waking of the proper threads when an event of interest occurs on an
object.
.Pp
.Fn selrecord
records that the calling thread is interested in events related to
a given object.
If another thread is already waiting on the object, a collision will
be flagged in
.Fa sip ,
records that the calling thread is interested in events related to a given
object.
If another thread is already waiting on the object a collision will be flagged
in
.Fa sip
which will be later dealt with by
.Fn selwakeup .
.Pp
.Fn selwakeup
is called by the underlying object handling code in order to notify
any waiting threads that an event of interest has occurred.
is called by the underlying object handling code in order to notify any waiting
threads that an event of interest has occurred.
If a collision has occurred,
.Fn selwakeup
will increment
@ -73,8 +75,8 @@ will increment
and wakeup all threads waiting on the global variable
.Va selwait
so that they can handle it.
If the thread waiting on the object is not currently sleeping or
the wait channel is not
If the thread waiting on the object is not currently sleeping or the wait
channel is not
.Va selwait ,
.Fn selwakeup
will clear the
@ -88,9 +90,23 @@ when they wake up.
.Fn selwakeup
may acquire and release
.Va sched_lock .
.Pp
.Fn selnotify
calls
.Fn selwakup
and then calls
.Fn KNOTE
with
.Va knhint .
In the most cases,
.Fn selnotify
should be used rather than using
.Fn selwakeup
directly.
.Sh SEE ALSO
.Xr poll 2 ,
.Xr select 2
.Xr select 2 ,
.Xr knote 9
.Sh AUTHORS
.An -nosplit
This man page was written by