Source-Changes-HG archive

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

[src/trunk]: src/sys/sys Don't pollute <sys/condvar.h> with <sys/mutex.h>.



details:   https://anonhg.NetBSD.org/src/rev/9aa0ce466ed7
branches:  trunk
changeset: 814779:9aa0ce466ed7
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sat Apr 09 16:59:43 2016 +0000

description:
Don't pollute <sys/condvar.h> with <sys/mutex.h>.

Instead, forward-declare struct kmutex, since we only need to
describe pointer types to it.

This breaks an include cycle on several architectures:

sys/cpu_data.h
-> sys/condvar.h
-> sys/mutex.h
-> sys/intr.h
-> machine/intr.h
-> machine/cpu.h
-> sys/cpu_data.h

diffstat:

 sys/sys/condvar.h |  14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diffs (37 lines):

diff -r 95a25120c510 -r 9aa0ce466ed7 sys/sys/condvar.h
--- a/sys/sys/condvar.h Sat Apr 09 15:18:48 2016 +0000
+++ b/sys/sys/condvar.h Sat Apr 09 16:59:43 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: condvar.h,v 1.12 2009/12/05 22:38:19 pooka Exp $       */
+/*     $NetBSD: condvar.h,v 1.13 2016/04/09 16:59:43 riastradh Exp $   */
 
 /*-
  * Copyright (c) 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -32,21 +32,21 @@
 #ifndef _SYS_CONDVAR_H_
 #define        _SYS_CONDVAR_H_
 
-#include <sys/mutex.h>
-
 typedef struct kcondvar {
        void            *cv_opaque[3];
 } kcondvar_t;
 
 #ifdef _KERNEL
 
+struct kmutex;
+
 void   cv_init(kcondvar_t *, const char *);
 void   cv_destroy(kcondvar_t *);
 
-void   cv_wait(kcondvar_t *, kmutex_t *);
-int    cv_wait_sig(kcondvar_t *, kmutex_t *);
-int    cv_timedwait(kcondvar_t *, kmutex_t *, int);
-int    cv_timedwait_sig(kcondvar_t *, kmutex_t *, int);
+void   cv_wait(kcondvar_t *, struct kmutex *);
+int    cv_wait_sig(kcondvar_t *, struct kmutex *);
+int    cv_timedwait(kcondvar_t *, struct kmutex *, int);
+int    cv_timedwait_sig(kcondvar_t *, struct kmutex *, int);
 
 void   cv_signal(kcondvar_t *);
 void   cv_broadcast(kcondvar_t *);



Home | Main Index | Thread Index | Old Index