run clang-format
This commit is contained in:
@@ -10,31 +10,32 @@
|
||||
* Define a structure, with a mutex and condition variable.
|
||||
*/
|
||||
typedef struct my_struct_tag {
|
||||
pthread_mutex_t mutex; /* Protects access to value */
|
||||
pthread_cond_t cond; /* Signals change to value */
|
||||
int value; /* Access protected by mutex */
|
||||
pthread_mutex_t mutex; /* Protects access to value */
|
||||
pthread_cond_t cond; /* Signals change to value */
|
||||
int value; /* Access protected by mutex */
|
||||
} my_struct_t;
|
||||
|
||||
int main (int argc, char *argv[])
|
||||
int
|
||||
main(int argc, char* argv[])
|
||||
{
|
||||
my_struct_t *data;
|
||||
int status;
|
||||
my_struct_t* data;
|
||||
int status;
|
||||
|
||||
data = malloc (sizeof (my_struct_t));
|
||||
if (data == NULL)
|
||||
errno_abort ("Allocate structure");
|
||||
status = pthread_mutex_init (&data->mutex, NULL);
|
||||
if (status != 0)
|
||||
err_abort (status, "Init mutex");
|
||||
status = pthread_cond_init (&data->cond, NULL);
|
||||
if (status != 0)
|
||||
err_abort (status, "Init condition");
|
||||
status = pthread_cond_destroy (&data->cond);
|
||||
if (status != 0)
|
||||
err_abort (status, "Destroy condition");
|
||||
status = pthread_mutex_destroy (&data->mutex);
|
||||
if (status != 0)
|
||||
err_abort (status, "Destroy mutex");
|
||||
(void)free (data);
|
||||
return status;
|
||||
data = malloc(sizeof(my_struct_t));
|
||||
if (data == NULL)
|
||||
errno_abort("Allocate structure");
|
||||
status = pthread_mutex_init(&data->mutex, NULL);
|
||||
if (status != 0)
|
||||
err_abort(status, "Init mutex");
|
||||
status = pthread_cond_init(&data->cond, NULL);
|
||||
if (status != 0)
|
||||
err_abort(status, "Init condition");
|
||||
status = pthread_cond_destroy(&data->cond);
|
||||
if (status != 0)
|
||||
err_abort(status, "Destroy condition");
|
||||
status = pthread_mutex_destroy(&data->mutex);
|
||||
if (status != 0)
|
||||
err_abort(status, "Destroy mutex");
|
||||
(void) free(data);
|
||||
return status;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user