diff options
author | Juri Lelli <juri.lelli@gmail.com> | 2013-10-04 12:26:25 +0200 |
---|---|---|
committer | Juri Lelli <juri.lelli@gmail.com> | 2013-10-04 12:26:25 +0200 |
commit | 412ae6e9c66cf1a7ca5d6b17d9fe09c21ce65aef (patch) | |
tree | 5e33b619ed75548ba99714b9cdbb4b5ea7fd3d67 | |
parent | 4284ebd7db18dc154b27a3cef67949f9db9d156c (diff) |
Create PI-enabled mutexes
-rw-r--r-- | src/rt-app_parse_config.c | 6 | ||||
-rw-r--r-- | src/rt-app_types.h | 1 |
2 files changed, 6 insertions, 1 deletions
diff --git a/src/rt-app_parse_config.c b/src/rt-app_parse_config.c index fbb9ec1..aa9e27b 100644 --- a/src/rt-app_parse_config.c +++ b/src/rt-app_parse_config.c @@ -170,7 +170,11 @@ parse_resources(struct json_object *resources, rtapp_options_t *opts) log_info(PFX "Creating %d resources", res); opts->resources = malloc(sizeof(rtapp_resource_t) * res); for (i = 0; i < res; i++) { - pthread_mutex_init(&opts->resources[i].mtx, NULL); + pthread_mutexattr_init(&opts->resources[i].mtx_attr); + pthread_mutexattr_setprotocol(&opts->resources[i].mtx_attr, + PTHREAD_PRIO_INHERIT); + pthread_mutex_init(&opts->resources[i].mtx, + &opts->resources[i].mtx_attr); opts->resources[i].index = i; } opts->nresources = res; diff --git a/src/rt-app_types.h b/src/rt-app_types.h index 524e767..c58b512 100644 --- a/src/rt-app_types.h +++ b/src/rt-app_types.h @@ -58,6 +58,7 @@ typedef enum policy_t /* Shared resources */ typedef struct _rtapp_resource_t { pthread_mutex_t mtx; + pthread_mutexattr_t mtx_attr; int index; } rtapp_resource_t; |