aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2008-09-26 10:46:10 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2008-09-26 10:46:10 +0000
commit8feba91865981a1cb8b1ba12c4bce09997141f2f (patch)
tree49383b0d56e82f342e74b6fa3ac831b884070150
parent3d4a6e15ed6b9dc80403288b36d22839de6e2320 (diff)
downloadChibiOS-8feba91865981a1cb8b1ba12c4bce09997141f2f.tar.gz
ChibiOS-8feba91865981a1cb8b1ba12c4bce09997141f2f.tar.bz2
ChibiOS-8feba91865981a1cb8b1ba12c4bce09997141f2f.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@444 35acf78f-673a-0410-8e92-d51de3d6d3f4
-rw-r--r--demos/ARM7-AT91SAM7X-GCC/chconf.h36
-rw-r--r--demos/ARM7-AT91SAM7X-WEB-GCC/chconf.h34
-rw-r--r--demos/ARM7-LPC214x-G++/chconf.h34
-rw-r--r--demos/ARM7-LPC214x-GCC-minimal/chconf.h34
-rw-r--r--demos/ARM7-LPC214x-GCC/chconf.h34
-rw-r--r--demos/ARMCM3-STM32F103-GCC/chconf.h34
-rw-r--r--demos/AVR-AT90CANx-GCC/chconf.h34
-rw-r--r--demos/AVR-ATmega128-GCC/chconf.h34
-rw-r--r--demos/MSP430-MSP430x1611-GCC/chconf.h34
-rw-r--r--demos/Win32-MinGW/chconf.h35
-rw-r--r--docs/Doxyfile1
-rw-r--r--readme.txt8
-rw-r--r--src/chthreads.c13
-rw-r--r--src/include/threads.h2
-rw-r--r--src/templates/chconf.h34
15 files changed, 181 insertions, 220 deletions
diff --git a/demos/ARM7-AT91SAM7X-GCC/chconf.h b/demos/ARM7-AT91SAM7X-GCC/chconf.h
index 13c3766e4..f6f40d5e3 100644
--- a/demos/ARM7-AT91SAM7X-GCC/chconf.h
+++ b/demos/ARM7-AT91SAM7X-GCC/chconf.h
@@ -34,13 +34,6 @@
* that this is not related to the compiler optimization options.*/
#define CH_OPTIMIZE_SPEED
-/** Configuration option: it specified this option enables the \p Thread
- * extension fields and initiazation code.
- * @see THREAD_EXT_FIELDS
- * @see THREAD_EXT_INIT
- */
-//#define CH_USE_THREAD_EXT
-
/** Configuration option: if specified then the Virtual Timers subsystem is
* included in the kernel.*/
#define CH_USE_VIRTUAL_TIMERS
@@ -79,10 +72,12 @@
* the kernel.*/
#define CH_USE_EVENTS
-/** Configuration option: if specified then the \p chEvtWaitTimeout()
- * function is included in the kernel.
+/** Configuration option: if specified then the
+ * \p chThdGetExitEventSource() function is included in the kernel.
* @note requires \p CH_USE_EVENTS.
- * @note requires \p CH_USE_VIRTUAL_TIMERS.*/
+ * @deprecated \p THREAD_EXT_EXIT should be used, this functionality will be
+ * removed in version 1.0.0.
+ */
#define CH_USE_EVENTS_TIMEOUT
/** Configuration option: if specified then the Synchronous Messages APIs are
@@ -185,21 +180,22 @@
*/
//#define CH_USE_TRACE
-/** User fields added to the end of the \p Thread structure if the
- * \p CH_USE_THREAD_EXT option is enabled.
- * @see CH_USE_THREAD_EXT
- */
+/** User fields added to the end of the \p Thread structure. */
#define THREAD_EXT_FIELDS \
struct { \
- /* Add fields here.*/ \
+ /* Add thread custom fields here.*/ \
};
-/** User initialization code added to the \p chThdCreate() API if the
- * \p CH_USE_THREAD_EXT option is enabled.
- * @see CH_USE_THREAD_EXT
- */
+/** User initialization code added to the \p chThdCreate() API.
+ * @note It is invoked from within \p chThdInit(). */
#define THREAD_EXT_INIT(tp) { \
- /* Add initialization code here.*/ \
+ /* Add thread initialization code here.*/ \
+}
+
+/** User finalization code added to the \p chThdExit() API.
+ * @note It is inserted into lock zone. */
+#define THREAD_EXT_EXIT(tp) { \
+ /* Add thread finalization code here.*/ \
}
#endif /* _CHCONF_H_ */
diff --git a/demos/ARM7-AT91SAM7X-WEB-GCC/chconf.h b/demos/ARM7-AT91SAM7X-WEB-GCC/chconf.h
index 13c3766e4..a5b956523 100644
--- a/demos/ARM7-AT91SAM7X-WEB-GCC/chconf.h
+++ b/demos/ARM7-AT91SAM7X-WEB-GCC/chconf.h
@@ -34,13 +34,6 @@
* that this is not related to the compiler optimization options.*/
#define CH_OPTIMIZE_SPEED
-/** Configuration option: it specified this option enables the \p Thread
- * extension fields and initiazation code.
- * @see THREAD_EXT_FIELDS
- * @see THREAD_EXT_INIT
- */
-//#define CH_USE_THREAD_EXT
-
/** Configuration option: if specified then the Virtual Timers subsystem is
* included in the kernel.*/
#define CH_USE_VIRTUAL_TIMERS
@@ -102,8 +95,10 @@
/** Configuration option: if specified then the
* \p chThdGetExitEventSource() function is included in the kernel.
- * @note requires \p CH_USE_MESSAGES.
- * @note requires \p CH_USE_EVENTS.*/
+ * @note requires \p CH_USE_EVENTS.
+ * @deprecated \p THREAD_EXT_EXIT should be used, this functionality will be
+ * removed in version 1.0.0.
+ */
#define CH_USE_EXIT_EVENT
/** Configuration option: if specified then the I/O queues APIs are included
@@ -185,21 +180,22 @@
*/
//#define CH_USE_TRACE
-/** User fields added to the end of the \p Thread structure if the
- * \p CH_USE_THREAD_EXT option is enabled.
- * @see CH_USE_THREAD_EXT
- */
+/** User fields added to the end of the \p Thread structure. */
#define THREAD_EXT_FIELDS \
struct { \
- /* Add fields here.*/ \
+ /* Add thread custom fields here.*/ \
};
-/** User initialization code added to the \p chThdCreate() API if the
- * \p CH_USE_THREAD_EXT option is enabled.
- * @see CH_USE_THREAD_EXT
- */
+/** User initialization code added to the \p chThdCreate() API.
+ * @note It is invoked from within \p chThdInit(). */
#define THREAD_EXT_INIT(tp) { \
- /* Add initialization code here.*/ \
+ /* Add thread initialization code here.*/ \
+}
+
+/** User finalization code added to the \p chThdExit() API.
+ * @note It is inserted into lock zone. */
+#define THREAD_EXT_EXIT(tp) { \
+ /* Add thread finalization code here.*/ \
}
#endif /* _CHCONF_H_ */
diff --git a/demos/ARM7-LPC214x-G++/chconf.h b/demos/ARM7-LPC214x-G++/chconf.h
index 3bf626af0..b307e8a52 100644
--- a/demos/ARM7-LPC214x-G++/chconf.h
+++ b/demos/ARM7-LPC214x-G++/chconf.h
@@ -34,13 +34,6 @@
* that this is not related to the compiler optimization options.*/
#define CH_OPTIMIZE_SPEED
-/** Configuration option: it specified this option enables the \p Thread
- * extension fields and initiazation code.
- * @see THREAD_EXT_FIELDS
- * @see THREAD_EXT_INIT
- */
-//#define CH_USE_THREAD_EXT
-
/** Configuration option: if specified then the Virtual Timers subsystem is
* included in the kernel.*/
#define CH_USE_VIRTUAL_TIMERS
@@ -102,8 +95,10 @@
/** Configuration option: if specified then the
* \p chThdGetExitEventSource() function is included in the kernel.
- * @note requires \p CH_USE_MESSAGES.
- * @note requires \p CH_USE_EVENTS.*/
+ * @note requires \p CH_USE_EVENTS.
+ * @deprecated \p THREAD_EXT_EXIT should be used, this functionality will be
+ * removed in version 1.0.0.
+ */
#define CH_USE_EXIT_EVENT
/** Configuration option: if specified then the I/O queues APIs are included
@@ -185,21 +180,22 @@
*/
//#define CH_USE_TRACE
-/** User fields added to the end of the \p Thread structure if the
- * \p CH_USE_THREAD_EXT option is enabled.
- * @see CH_USE_THREAD_EXT
- */
+/** User fields added to the end of the \p Thread structure. */
#define THREAD_EXT_FIELDS \
struct { \
- /* Add fields here.*/ \
+ /* Add thread custom fields here.*/ \
};
-/** User initialization code added to the \p chThdCreate() API if the
- * \p CH_USE_THREAD_EXT option is enabled.
- * @see CH_USE_THREAD_EXT
- */
+/** User initialization code added to the \p chThdCreate() API.
+ * @note It is invoked from within \p chThdInit(). */
#define THREAD_EXT_INIT(tp) { \
- /* Add initialization code here.*/ \
+ /* Add thread initialization code here.*/ \
+}
+
+/** User finalization code added to the \p chThdExit() API.
+ * @note It is inserted into lock zone. */
+#define THREAD_EXT_EXIT(tp) { \
+ /* Add thread finalization code here.*/ \
}
#endif /* _CHCONF_H_ */
diff --git a/demos/ARM7-LPC214x-GCC-minimal/chconf.h b/demos/ARM7-LPC214x-GCC-minimal/chconf.h
index da927fe6a..ade1aa207 100644
--- a/demos/ARM7-LPC214x-GCC-minimal/chconf.h
+++ b/demos/ARM7-LPC214x-GCC-minimal/chconf.h
@@ -34,13 +34,6 @@
* that this is not related to the compiler optimization options.*/
//#define CH_OPTIMIZE_SPEED
-/** Configuration option: it specified this option enables the \p Thread
- * extension fields and initiazation code.
- * @see THREAD_EXT_FIELDS
- * @see THREAD_EXT_INIT
- */
-//#define CH_USE_THREAD_EXT
-
/** Configuration option: if specified then the Virtual Timers subsystem is
* included in the kernel.*/
#define CH_USE_VIRTUAL_TIMERS
@@ -102,8 +95,10 @@
/** Configuration option: if specified then the
* \p chThdGetExitEventSource() function is included in the kernel.
- * @note requires \p CH_USE_MESSAGES.
- * @note requires \p CH_USE_EVENTS.*/
+ * @note requires \p CH_USE_EVENTS.
+ * @deprecated \p THREAD_EXT_EXIT should be used, this functionality will be
+ * removed in version 1.0.0.
+ */
//#define CH_USE_EXIT_EVENT
/** Configuration option: if specified then the I/O queues APIs are included
@@ -185,21 +180,22 @@
*/
//#define CH_USE_TRACE
-/** User fields added to the end of the \p Thread structure if the
- * \p CH_USE_THREAD_EXT option is enabled.
- * @see CH_USE_THREAD_EXT
- */
+/** User fields added to the end of the \p Thread structure. */
#define THREAD_EXT_FIELDS \
struct { \
- /* Add fields here.*/ \
+ /* Add thread custom fields here.*/ \
};
-/** User initialization code added to the \p chThdCreate() API if the
- * \p CH_USE_THREAD_EXT option is enabled.
- * @see CH_USE_THREAD_EXT
- */
+/** User initialization code added to the \p chThdCreate() API.
+ * @note It is invoked from within \p chThdInit(). */
#define THREAD_EXT_INIT(tp) { \
- /* Add initialization code here.*/ \
+ /* Add thread initialization code here.*/ \
+}
+
+/** User finalization code added to the \p chThdExit() API.
+ * @note It is inserted into lock zone. */
+#define THREAD_EXT_EXIT(tp) { \
+ /* Add thread finalization code here.*/ \
}
#endif /* _CHCONF_H_ */
diff --git a/demos/ARM7-LPC214x-GCC/chconf.h b/demos/ARM7-LPC214x-GCC/chconf.h
index 13c3766e4..a5b956523 100644
--- a/demos/ARM7-LPC214x-GCC/chconf.h
+++ b/demos/ARM7-LPC214x-GCC/chconf.h
@@ -34,13 +34,6 @@
* that this is not related to the compiler optimization options.*/
#define CH_OPTIMIZE_SPEED
-/** Configuration option: it specified this option enables the \p Thread
- * extension fields and initiazation code.
- * @see THREAD_EXT_FIELDS
- * @see THREAD_EXT_INIT
- */
-//#define CH_USE_THREAD_EXT
-
/** Configuration option: if specified then the Virtual Timers subsystem is
* included in the kernel.*/
#define CH_USE_VIRTUAL_TIMERS
@@ -102,8 +95,10 @@
/** Configuration option: if specified then the
* \p chThdGetExitEventSource() function is included in the kernel.
- * @note requires \p CH_USE_MESSAGES.
- * @note requires \p CH_USE_EVENTS.*/
+ * @note requires \p CH_USE_EVENTS.
+ * @deprecated \p THREAD_EXT_EXIT should be used, this functionality will be
+ * removed in version 1.0.0.
+ */
#define CH_USE_EXIT_EVENT
/** Configuration option: if specified then the I/O queues APIs are included
@@ -185,21 +180,22 @@
*/
//#define CH_USE_TRACE
-/** User fields added to the end of the \p Thread structure if the
- * \p CH_USE_THREAD_EXT option is enabled.
- * @see CH_USE_THREAD_EXT
- */
+/** User fields added to the end of the \p Thread structure. */
#define THREAD_EXT_FIELDS \
struct { \
- /* Add fields here.*/ \
+ /* Add thread custom fields here.*/ \
};
-/** User initialization code added to the \p chThdCreate() API if the
- * \p CH_USE_THREAD_EXT option is enabled.
- * @see CH_USE_THREAD_EXT
- */
+/** User initialization code added to the \p chThdCreate() API.
+ * @note It is invoked from within \p chThdInit(). */
#define THREAD_EXT_INIT(tp) { \
- /* Add initialization code here.*/ \
+ /* Add thread initialization code here.*/ \
+}
+
+/** User finalization code added to the \p chThdExit() API.
+ * @note It is inserted into lock zone. */
+#define THREAD_EXT_EXIT(tp) { \
+ /* Add thread finalization code here.*/ \
}
#endif /* _CHCONF_H_ */
diff --git a/demos/ARMCM3-STM32F103-GCC/chconf.h b/demos/ARMCM3-STM32F103-GCC/chconf.h
index 13c3766e4..a5b956523 100644
--- a/demos/ARMCM3-STM32F103-GCC/chconf.h
+++ b/demos/ARMCM3-STM32F103-GCC/chconf.h
@@ -34,13 +34,6 @@
* that this is not related to the compiler optimization options.*/
#define CH_OPTIMIZE_SPEED
-/** Configuration option: it specified this option enables the \p Thread
- * extension fields and initiazation code.
- * @see THREAD_EXT_FIELDS
- * @see THREAD_EXT_INIT
- */
-//#define CH_USE_THREAD_EXT
-
/** Configuration option: if specified then the Virtual Timers subsystem is
* included in the kernel.*/
#define CH_USE_VIRTUAL_TIMERS
@@ -102,8 +95,10 @@
/** Configuration option: if specified then the
* \p chThdGetExitEventSource() function is included in the kernel.
- * @note requires \p CH_USE_MESSAGES.
- * @note requires \p CH_USE_EVENTS.*/
+ * @note requires \p CH_USE_EVENTS.
+ * @deprecated \p THREAD_EXT_EXIT should be used, this functionality will be
+ * removed in version 1.0.0.
+ */
#define CH_USE_EXIT_EVENT
/** Configuration option: if specified then the I/O queues APIs are included
@@ -185,21 +180,22 @@
*/
//#define CH_USE_TRACE
-/** User fields added to the end of the \p Thread structure if the
- * \p CH_USE_THREAD_EXT option is enabled.
- * @see CH_USE_THREAD_EXT
- */
+/** User fields added to the end of the \p Thread structure. */
#define THREAD_EXT_FIELDS \
struct { \
- /* Add fields here.*/ \
+ /* Add thread custom fields here.*/ \
};
-/** User initialization code added to the \p chThdCreate() API if the
- * \p CH_USE_THREAD_EXT option is enabled.
- * @see CH_USE_THREAD_EXT
- */
+/** User initialization code added to the \p chThdCreate() API.
+ * @note It is invoked from within \p chThdInit(). */
#define THREAD_EXT_INIT(tp) { \
- /* Add initialization code here.*/ \
+ /* Add thread initialization code here.*/ \
+}
+
+/** User finalization code added to the \p chThdExit() API.
+ * @note It is inserted into lock zone. */
+#define THREAD_EXT_EXIT(tp) { \
+ /* Add thread finalization code here.*/ \
}
#endif /* _CHCONF_H_ */
diff --git a/demos/AVR-AT90CANx-GCC/chconf.h b/demos/AVR-AT90CANx-GCC/chconf.h
index a3c3697af..ea26be7ad 100644
--- a/demos/AVR-AT90CANx-GCC/chconf.h
+++ b/demos/AVR-AT90CANx-GCC/chconf.h
@@ -34,13 +34,6 @@
* that this is not related to the compiler optimization options.*/
#define CH_OPTIMIZE_SPEED
-/** Configuration option: it specified this option enables the \p Thread
- * extension fields and initiazation code.
- * @see THREAD_EXT_FIELDS
- * @see THREAD_EXT_INIT
- */
-//#define CH_USE_THREAD_EXT
-
/** Configuration option: if specified then the Virtual Timers subsystem is
* included in the kernel.*/
#define CH_USE_VIRTUAL_TIMERS
@@ -102,8 +95,10 @@
/** Configuration option: if specified then the
* \p chThdGetExitEventSource() function is included in the kernel.
- * @note requires \p CH_USE_MESSAGES.
- * @note requires \p CH_USE_EVENTS.*/
+ * @note requires \p CH_USE_EVENTS.
+ * @deprecated \p THREAD_EXT_EXIT should be used, this functionality will be
+ * removed in version 1.0.0.
+ */
#define CH_USE_EXIT_EVENT
/** Configuration option: if specified then the I/O queues APIs are included
@@ -185,21 +180,22 @@
*/
//#define CH_USE_TRACE
-/** User fields added to the end of the \p Thread structure if the
- * \p CH_USE_THREAD_EXT option is enabled.
- * @see CH_USE_THREAD_EXT
- */
+/** User fields added to the end of the \p Thread structure. */
#define THREAD_EXT_FIELDS \
struct { \
- /* Add fields here.*/ \
+ /* Add thread custom fields here.*/ \
};
-/** User initialization code added to the \p chThdCreate() API if the
- * \p CH_USE_THREAD_EXT option is enabled.
- * @see CH_USE_THREAD_EXT
- */
+/** User initialization code added to the \p chThdCreate() API.
+ * @note It is invoked from within \p chThdInit(). */
#define THREAD_EXT_INIT(tp) { \
- /* Add initialization code here.*/ \
+ /* Add thread initialization code here.*/ \
+}
+
+/** User finalization code added to the \p chThdExit() API.
+ * @note It is inserted into lock zone. */
+#define THREAD_EXT_EXIT(tp) { \
+ /* Add thread finalization code here.*/ \
}
#endif /* _CHCONF_H_ */
diff --git a/demos/AVR-ATmega128-GCC/chconf.h b/demos/AVR-ATmega128-GCC/chconf.h
index f3975e8a4..34b26c7be 100644
--- a/demos/AVR-ATmega128-GCC/chconf.h
+++ b/demos/AVR-ATmega128-GCC/chconf.h
@@ -34,13 +34,6 @@
* that this is not related to the compiler optimization options.*/
#define CH_OPTIMIZE_SPEED
-/** Configuration option: it specified this option enables the \p Thread
- * extension fields and initiazation code.
- * @see THREAD_EXT_FIELDS
- * @see THREAD_EXT_INIT
- */
-//#define CH_USE_THREAD_EXT
-
/** Configuration option: if specified then the Virtual Timers subsystem is
* included in the kernel.*/
#define CH_USE_VIRTUAL_TIMERS
@@ -102,8 +95,10 @@
/** Configuration option: if specified then the
* \p chThdGetExitEventSource() function is included in the kernel.
- * @note requires \p CH_USE_MESSAGES.
- * @note requires \p CH_USE_EVENTS.*/
+ * @note requires \p CH_USE_EVENTS.
+ * @deprecated \p THREAD_EXT_EXIT should be used, this functionality will be
+ * removed in version 1.0.0.
+ */
#define CH_USE_EXIT_EVENT
/** Configuration option: if specified then the I/O queues APIs are included
@@ -185,21 +180,22 @@
*/
//#define CH_USE_TRACE
-/** User fields added to the end of the \p Thread structure if the
- * \p CH_USE_THREAD_EXT option is enabled.
- * @see CH_USE_THREAD_EXT
- */
+/** User fields added to the end of the \p Thread structure. */
#define THREAD_EXT_FIELDS \
struct { \
- /* Add fields here.*/ \
+ /* Add thread custom fields here.*/ \
};
-/** User initialization code added to the \p chThdCreate() API if the
- * \p CH_USE_THREAD_EXT option is enabled.
- * @see CH_USE_THREAD_EXT
- */
+/** User initialization code added to the \p chThdCreate() API.
+ * @note It is invoked from within \p chThdInit(). */
#define THREAD_EXT_INIT(tp) { \
- /* Add initialization code here.*/ \
+ /* Add thread initialization code here.*/ \
+}
+
+/** User finalization code added to the \p chThdExit() API.
+ * @note It is inserted into lock zone. */
+#define THREAD_EXT_EXIT(tp) { \
+ /* Add thread finalization code here.*/ \
}
#endif /* _CHCONF_H_ */
diff --git a/demos/MSP430-MSP430x1611-GCC/chconf.h b/demos/MSP430-MSP430x1611-GCC/chconf.h
index 40a333f1c..da9878f86 100644
--- a/demos/MSP430-MSP430x1611-GCC/chconf.h
+++ b/demos/MSP430-MSP430x1611-GCC/chconf.h
@@ -35,13 +35,6 @@
* that this is not related to the compiler optimization options.*/
#define CH_OPTIMIZE_SPEED
-/** Configuration option: it specified this option enables the \p Thread
- * extension fields and initiazation code.
- * @see THREAD_EXT_FIELDS
- * @see THREAD_EXT_INIT
- */
-//#define CH_USE_THREAD_EXT
-
/** Configuration option: if specified then the Virtual Timers subsystem is
* included in the kernel.*/
#define CH_USE_VIRTUAL_TIMERS
@@ -103,8 +96,10 @@
/** Configuration option: if specified then the
* \p chThdGetExitEventSource() function is included in the kernel.
- * @note requires \p CH_USE_MESSAGES.
- * @note requires \p CH_USE_EVENTS.*/
+ * @note requires \p CH_USE_EVENTS.
+ * @deprecated \p THREAD_EXT_EXIT should be used, this functionality will be
+ * removed in version 1.0.0.
+ */
#define CH_USE_EXIT_EVENT
/** Configuration option: if specified then the I/O queues APIs are included
@@ -186,21 +181,22 @@
*/
//#define CH_USE_TRACE
-/** User fields added to the end of the \p Thread structure if the
- * \p CH_USE_THREAD_EXT option is enabled.
- * @see CH_USE_THREAD_EXT
- */
+/** User fields added to the end of the \p Thread structure. */
#define THREAD_EXT_FIELDS \
struct { \
- /* Add fields here.*/ \
+ /* Add thread custom fields here.*/ \
};
-/** User initialization code added to the \p chThdCreate() API if the
- * \p CH_USE_THREAD_EXT option is enabled.
- * @see CH_USE_THREAD_EXT
- */
+/** User initialization code added to the \p chThdCreate() API.
+ * @note It is invoked from within \p chThdInit(). */
#define THREAD_EXT_INIT(tp) { \
- /* Add initialization code here.*/ \
+ /* Add thread initialization code here.*/ \
+}
+
+/** User finalization code added to the \p chThdExit() API.
+ * @note It is inserted into lock zone. */
+#define THREAD_EXT_EXIT(tp) { \
+ /* Add thread finalization code here.*/ \
}
#endif /* _CHCONF_H_ */
diff --git a/demos/Win32-MinGW/chconf.h b/demos/Win32-MinGW/chconf.h
index c5bbf0410..46272d552 100644
--- a/demos/Win32-MinGW/chconf.h
+++ b/demos/Win32-MinGW/chconf.h
@@ -34,13 +34,6 @@
* that this is not related to the compiler optimization options.*/
#define CH_OPTIMIZE_SPEED
-/** Configuration option: it specified this option enables the \p Thread
- * extension fields and initiazation code.
- * @see THREAD_EXT_FIELDS
- * @see THREAD_EXT_INIT
- */
-//#define CH_USE_THREAD_EXT
-
/** Configuration option: if specified then the Virtual Timers subsystem is
* included in the kernel.*/
#define CH_USE_VIRTUAL_TIMERS
@@ -102,9 +95,10 @@
/** Configuration option: if specified then the
* \p chThdGetExitEventSource() function is included in the kernel.
- * @deprecated
- * @note requires \p CH_USE_MESSAGES.
- * @note requires \p CH_USE_EVENTS.*/
+ * @note requires \p CH_USE_EVENTS.
+ * @deprecated \p THREAD_EXT_EXIT should be used, this functionality will be
+ * removed in version 1.0.0.
+ */
#define CH_USE_EXIT_EVENT
/** Configuration option: if specified then the I/O queues APIs are included
@@ -186,21 +180,22 @@
*/
//#define CH_USE_TRACE
-/** User fields added to the end of the \p Thread structure if the
- * \p CH_USE_THREAD_EXT option is enabled.
- * @see CH_USE_THREAD_EXT
- */
+/** User fields added to the end of the \p Thread structure. */
#define THREAD_EXT_FIELDS \
struct { \
- /* Add fields here.*/ \
+ /* Add thread custom fields here.*/ \
};
-/** User initialization code added to the \p chThdCreate() API if the
- * \p CH_USE_THREAD_EXT option is enabled.
- * @see CH_USE_THREAD_EXT
- */
+/** User initialization code added to the \p chThdCreate() API.
+ * @note It is invoked from within \p chThdInit(). */
#define THREAD_EXT_INIT(tp) { \
- /* Add initialization code here.*/ \
+ /* Add thread initialization code here.*/ \
+}
+
+/** User finalization code added to the \p chThdExit() API.
+ * @note It is inserted into lock zone. */
+#define THREAD_EXT_EXIT(tp) { \
+ /* Add thread finalization code here.*/ \
}
#endif /* _CHCONF_H_ */
diff --git a/docs/Doxyfile b/docs/Doxyfile
index 3abb12ff1..0f75703be 100644
--- a/docs/Doxyfile
+++ b/docs/Doxyfile
@@ -238,7 +238,6 @@ INCLUDE_PATH =
INCLUDE_FILE_PATTERNS =
PREDEFINED = __JUST_STUBS__ \
__DOXIGEN__ \
- CH_USE_THREAD_EXT \
CH_USE_VIRTUAL_TIMERS \
CH_USE_SYSTEMTIME \
CH_USE_WAITEXIT \
diff --git a/readme.txt b/readme.txt
index 86d627a00..b92129785 100644
--- a/readme.txt
+++ b/readme.txt
@@ -81,13 +81,19 @@ Win32-MinGW - ChibiOS/RT simulator and demo into a WIN32 process,
- NEW: New dynamic chThdCreateFromHeap() and chthdCreateFromMemoryPool() APIs.
The dynamic APIs are only included if the CH_USE_DYNAMIC option is specified
into the project configuration file.
+- NEW: Added an THREAD_EXT_EXIT macro in chconf.h to add finalization code to
+ the chThdExit() API.
- CHANGE: chThdCreateFast() is now a macro that uses chThdCreateStatic().
- CHANGE: chThdWait() now releases the memory allocated by
chThdCreateFromHeap() and chthdCreateFromMemoryPool(). Threads created
through the static APIs are not affected thus the behavior is backward
compatible.
- CHANGE: Modified the chThdResume() API to return the resumed thread pointer
- instead of void.
+ instead of void. This allowed few optimization into the threads creation
+ code.
+- CHANGE: The chThdGetExitEventSource() API and the CH_USE_EXIT_EVENT
+ configuration option and the are now deprecated. Use the THREAD_EXT_EXIT
+ finalization macro in order to implement a similar functionality if needed.
- FIX: The chThdCreate() had a regression in 0.7.0, the mode parameter was
ignored.
- FIX: Removed duplicated call to chHeapInit() into chSysInit().
diff --git a/src/chthreads.c b/src/chthreads.c
index 676df3d68..755cda99e 100644
--- a/src/chthreads.c
+++ b/src/chthreads.c
@@ -51,9 +51,7 @@ Thread *init_thread(Thread *tp, tprio_t prio) {
#ifdef CH_USE_EXIT_EVENT
chEvtInit(&tp->p_exitesource);
#endif
-#ifdef CH_USE_THREAD_EXT
THREAD_EXT_INIT(tp);
-#endif
return tp;
}
@@ -295,16 +293,17 @@ void chThdTerminate(Thread *tp) {
* \p chThdWait().
*/
void chThdExit(msg_t msg) {
+ Thread *tp = currp;
chSysLock();
-
- currp->p_exitcode = msg;
+ tp->p_exitcode = msg;
+ THREAD_EXT_EXIT(tp);
#ifdef CH_USE_WAITEXIT
- while (notempty(&currp->p_waiting))
- chSchReadyI(list_remove(&currp->p_waiting));
+ while (notempty(&tp->p_waiting))
+ chSchReadyI(list_remove(&tp->p_waiting));
#endif
#ifdef CH_USE_EXIT_EVENT
- chEvtBroadcastI(&currp->p_exitesource);
+ chEvtBroadcastI(&tp->p_exitesource);
#endif
chSchGoSleepS(PREXIT);
}
diff --git a/src/include/threads.h b/src/include/threads.h
index 5248c807e..099b8466f 100644
--- a/src/include/threads.h
+++ b/src/include/threads.h
@@ -235,6 +235,8 @@ extern "C" {
* the event source becomes inactive.
* @note The function is available only if the \p CH_USE_EXIT_EVENT
* option is enabled in \p chconf.h.
+ * @deprecated \p THREAD_EXT_EXIT should be used, this functionality will be
+ * removed in version 1.0.0.
*/
#define chThdGetExitEventSource(tp) (&(tp)->p_exitesource)
diff --git a/src/templates/chconf.h b/src/templates/chconf.h
index 1f5ca1446..37569772e 100644
--- a/src/templates/chconf.h
+++ b/src/templates/chconf.h
@@ -35,13 +35,6 @@
* that this is not related to the compiler optimization options.*/
#define CH_OPTIMIZE_SPEED
-/** Configuration option: it specified this option enables the \p Thread
- * extension fields and initiazation code.
- * @see THREAD_EXT_FIELDS
- * @see THREAD_EXT_INIT
- */
-#define CH_USE_THREAD_EXT
-
/** Configuration option: if specified then the Virtual Timers subsystem is
* included in the kernel.*/
#define CH_USE_VIRTUAL_TIMERS
@@ -103,8 +96,10 @@
/** Configuration option: if specified then the
* \p chThdGetExitEventSource() function is included in the kernel.
- * @note requires \p CH_USE_MESSAGES.
- * @note requires \p CH_USE_EVENTS.*/
+ * @note requires \p CH_USE_EVENTS.
+ * @deprecated \p THREAD_EXT_EXIT should be used, this functionality will be
+ * removed in version 1.0.0.
+ */
#define CH_USE_EXIT_EVENT
/** Configuration option: if specified then the I/O queues APIs are included
@@ -186,21 +181,22 @@
*/
#define CH_USE_TRACE
-/** User fields added to the end of the \p Thread structure if the
- * \p CH_USE_THREAD_EXT option is enabled.
- * @see CH_USE_THREAD_EXT
- */
+/** User fields added to the end of the \p Thread structure. */
#define THREAD_EXT_FIELDS \
struct { \
- /* Add fields here.*/ \
+ /* Add thread custom fields here.*/ \
};
-/** User initialization code added to the \p chThdCreate() API if the
- * \p CH_USE_THREAD_EXT option is enabled.
- * @see CH_USE_THREAD_EXT
- */
+/** User initialization code added to the \p chThdCreate() API.
+ * @note It is invoked from within \p chThdInit(). */
#define THREAD_EXT_INIT(tp) { \
- /* Add initialization code here.*/ \
+ /* Add thread initialization code here.*/ \
+}
+
+/** User finalization code added to the \p chThdExit() API.
+ * @note It is inserted into lock zone. */
+#define THREAD_EXT_EXIT(tp) { \
+ /* Add thread finalization code here.*/ \
}
#endif /* _CHCONF_H_ */