Re: git: 5317480967bf - main - sound: Remove CHN_F_SLEEPING
- In reply to: John Baldwin : "Re: git: 5317480967bf - main - sound: Remove CHN_F_SLEEPING"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 27 Nov 2024 15:33:29 UTC
On 27/11/2024 17:12, John Baldwin wrote: > On 11/26/24 12:17, Christos Margiolis wrote: >> John Baldwin wrote: >>> I'm not super excited about reading cv_waiters directly. Generally speaking >>> 'struct cv' is opaque to the rest of the kernel. Maybe add a little inline >>> routine or macro cv_waiters() that returns this value instead? Then it can >>> be documented in condvar.9 along with the caveats about when it is safe to >>> use. >> >> I see we already have cv_wmesg() in sys/sys/condvar.h to access >> cv_description. Maybe we could add a cv_waiters() macro in there as >> well? > > Yes, that is where I would add it. Perhaps, cv_waiters should be left as an implementation detail and an explicit counter should be added in the sound driver code as a replacement for CHN_F_SLEEPING flag? And for pre-existing checks of cv_waiters too. That sounds a bit redundant but all code that needs to check if something is waiting does it that way. cv_waiters is accessed only in kern_condvar.c, naturally, and in the sound driver. -- Andriy Gapon