Hailin
2013-03-28 10:34:22 +08:00
commit a5ec64177d
55 changed files with 6183 additions and 0 deletions

23
mutex_static.c Normal file
View File

@@ -0,0 +1,23 @@
/*
* mutex_static.c
*
* Demonstrate static initialization of a mutex.
*/
#include <pthread.h>
#include "errors.h"
/*
* Declare a structure, with a mutex, statically initialized. This is the
* same as using pthread_mutex_init, with the default attributes.
*/
typedef struct my_struct_tag {
pthread_mutex_t mutex; /* Protects access to value */
int value; /* Access protected by mutex */
} my_struct_t;
my_struct_t data = {PTHREAD_MUTEX_INITIALIZER, 0};
int main (int argc, char *argv[])
{
return 0;
}