PT_SPAWN() added, minor documentation changes, PT_INIT() less complex
diff --git a/contiki/ek/pt.h b/contiki/ek/pt.h
index 4d03c4e..54b54d5 100644
--- a/contiki/ek/pt.h
+++ b/contiki/ek/pt.h
@@ -136,9 +136,7 @@
*/
#define PT_START(pt) \
do { \
- if((pt)->lc == LC_NULL) { \
- LC_SET((pt)->lc); \
- } else { \
+ if((pt)->lc != LC_NULL) { \
LC_RESUME((pt)->lc); \
} \
} while(0)
@@ -228,6 +226,22 @@
PT_WAIT_UNTIL((pt), (thread))
/**
+ * Spawn a child protothread and wait until it exits.
+ *
+ * This macro spawns a child protothread and waits until it exits.
+ *
+ * \param pt A pointer to the protothread control structure.
+ * \param thread The child protothread with arguments
+ *
+ * \hideinitializer
+ */
+#define PT_SPAWN(pt, thread) \
+ do { \
+ PT_INIT((pt)); \
+ PT_WAIT_THREAD((pt), (thread)); \
+ } while(0)
+
+/**
* Restart the protothread.
*
* This macro will block and cause the protothread to restart its