tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

cv_fdrestart()



> On Oct 13, 2023, at 11:48 AM, Andrew Doran <ad%netbsd.org@localhost> wrote:
> 
> Module Name: src
> Committed By: ad
> Date: Fri Oct 13 18:48:56 UTC 2023
> 
> Modified Files:
> src/sys/kern: kern_condvar.c kern_sleepq.c
> src/sys/rump/librump/rumpkern: locks.c locks_up.c
> src/sys/sys: condvar.h lwp.h
> 
> Log Message:
> Add cv_fdrestart() (better name suggestions welcome):

Oooooof.

I’d suggest doing something like:

void
cv_broadcast_cb(kcondvar_t *cv, void (*callback)(lwp_t *))
{
. . .
}

. . . to make this a generic mechanism, rather that something so specialized for the few call sites that need this behavior.


> 
> Like cv_broadcast(), but make any LWPs that share the same file descriptor
> table as the caller return ERESTART when resuming.  Used to dislodge LWPs
> waiting for I/O that prevent a file descriptor from being closed, without
> upsetting access to the file (not descriptor) made from another direction.
> 
> 
> To generate a diff of this commit:
> cvs rdiff -u -r1.59 -r1.60 src/sys/kern/kern_condvar.c
> cvs rdiff -u -r1.83 -r1.84 src/sys/kern/kern_sleepq.c
> cvs rdiff -u -r1.86 -r1.87 src/sys/rump/librump/rumpkern/locks.c
> cvs rdiff -u -r1.12 -r1.13 src/sys/rump/librump/rumpkern/locks_up.c
> cvs rdiff -u -r1.17 -r1.18 src/sys/sys/condvar.h
> cvs rdiff -u -r1.227 -r1.228 src/sys/sys/lwp.h
> 
> Please note that diffs are not public domain; they are subject to the
> copyright notices on the relevant files.
> 

-- thorpej



Home | Main Index | Thread Index | Old Index