From: <ljs...@us...> - 2012-06-06 22:49:20
|
Revision: 801 http://cadcdev.svn.sourceforge.net/cadcdev/?rev=801&view=rev Author: ljsebald Date: 2012-06-06 22:49:14 +0000 (Wed, 06 Jun 2012) Log Message: ----------- Add initializers for transient semaphores, condvars, and mutexes. Modified Paths: -------------- kos/include/kos/cond.h kos/include/kos/mutex.h kos/include/kos/sem.h Modified: kos/include/kos/cond.h =================================================================== --- kos/include/kos/cond.h 2012-06-06 02:35:24 UTC (rev 800) +++ kos/include/kos/cond.h 2012-06-06 22:49:14 UTC (rev 801) @@ -66,6 +66,9 @@ LIST_HEAD(condlist, condvar); /* \endcond */ +/** \brief Initializer for a transient condvar. */ +#define COND_INITIALIZER { { 0 } } + /** \brief Allocate a new condition variable. This function allocates and initializes a new condition variable for use. Modified: kos/include/kos/mutex.h =================================================================== --- kos/include/kos/mutex.h 2012-06-06 02:35:24 UTC (rev 800) +++ kos/include/kos/mutex.h 2012-06-06 22:49:14 UTC (rev 801) @@ -39,6 +39,9 @@ */ typedef semaphore_t mutex_t; +/** \brief Initializer for a transient mutex. */ +#define MUTEX_INITIALIZER SEM_INITIALIZER(1) + /** \brief Allocate a new mutex. This function allocates and initializes a new mutex for use. Modified: kos/include/kos/sem.h =================================================================== --- kos/include/kos/sem.h 2012-06-06 02:35:24 UTC (rev 800) +++ kos/include/kos/sem.h 2012-06-06 22:49:14 UTC (rev 801) @@ -52,6 +52,10 @@ LIST_HEAD(semlist, semaphore); /** \endcond */ +/** \brief Initializer for a transient semaphore. + \param value The initial count of the semaphore. */ +#define SEM_INITIALIZER(value) { { 0 }, value } + /** \brief Allocate a new semaphore. This function allocates and initializes a new semaphore for use. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |