summaryrefslogtreecommitdiff
path: root/kern/types.h
diff options
context:
space:
mode:
authorRichard Braun <rbraun@sceen.net>2014-06-18 23:35:45 +0200
committerRichard Braun <rbraun@sceen.net>2014-06-18 23:35:45 +0200
commit701a5d9cf5a9416eb8303d703049bf1d4c6c69f0 (patch)
tree0b0fa70492a01df7fb9511ccd388e220f7fc150d /kern/types.h
parent6b5c9352dc34ef945259994b16c3e1fa1783aef4 (diff)
kern/thread: add thread_join
This change affects more files than it apparently would at first glance. This is because circular dependencies can easily be created between the thread, mutex, condition and spinlock modules. As a result, some of the types of these modules are now defined in kern/types.h.
Diffstat (limited to 'kern/types.h')
-rw-r--r--kern/types.h24
1 files changed, 23 insertions, 1 deletions
diff --git a/kern/types.h b/kern/types.h
index 5fc3cb59..5e8a7db4 100644
--- a/kern/types.h
+++ b/kern/types.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012 Richard Braun.
+ * Copyright (c) 2012-2014 Richard Braun.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -20,4 +20,26 @@
#include <machine/types.h>
+/*
+ * Types defined here to avoid inclusion loops.
+ */
+
+#include <kern/list.h>
+
+struct spinlock {
+ unsigned int locked;
+};
+
+struct mutex {
+ unsigned int state;
+ struct spinlock lock;
+ struct list waiters;
+};
+
+struct condition {
+ struct spinlock lock;
+ struct mutex *mutex;
+ struct list waiters;
+};
+
#endif /* _KERN_TYPES_H */