]> git.pond.sub.org Git - empserver/blobdiff - include/empthread.h
Fix generation numbers for autonav
[empserver] / include / empthread.h
index 99300b329f8d1ff7e94e79fde3b8124ba9c76f0d..d06efb10abf5f47c567470f3f9c8144b0f256ca7 100644 (file)
@@ -112,6 +112,7 @@ int empth_init(void **ctx, int flags);
 /*
  * Create a new thread.
  * ENTRY is the entry point.  It will be called with argument UD.
+ * If it returns, the thread terminates as if it called empth_exit().
  * Thread stack is at least SIZE bytes.
  * FLAGS should be the same as were passed to empth_init(), or zero.
  * NAME is the thread's name, it is used for logging and debugging.
@@ -153,25 +154,14 @@ void empth_exit(void);
  */
 void empth_yield(void);
 
-/*
- * Terminate THREAD.
- * THREAD will not be scheduled again.  Instead, it will terminate as
- * if it executed empth_exit().  It is unspecified when exactly that
- * happens.
- * THREAD must not be the current thread.
- * Naive use of this function almost always leads to resource leaks.
- * Terminating a thread that may hold locks is not a good idea.
- */
-void empth_terminate(empth_t *thread);
-
 /*
  * Put current thread to sleep until file descriptor FD is ready for I/O.
  * If FLAGS & EMPTH_FD_READ, wake up if FD is ready for input.
  * If FLAGS & EMPTH_FD_WRITE, wake up if FD is ready for output.
  * At most one thread may sleep on the same file descriptor.
  * TIMEOUT, if non-null, limits the sleep time.
- * Return one when the FD is ready, zero on timeout, -1 on error with
- * errno set.
+ * Return one when the FD is ready, zero on timeout or early wakeup by
+ * empth_wakeup(), -1 on error with errno set.
  * Note: Currently, Empire sleeps only on network I/O, i.e. FD is a
  * socket.  Implementations should not rely on that.
  */
@@ -179,7 +169,7 @@ int empth_select(int fd, int flags, struct timeval *timeout);
 
 /*
  * Awaken THREAD if it is sleeping in empth_select() or empth_sleep().
- * Note: This must not awaken threads sleeping in other functions.
+ * This does not awaken threads sleeping in other functions.
  * Does not yield the processor.
  */
 void empth_wakeup(empth_t *thread);