summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuri Lelli <juri.lelli@gmail.com>2013-10-04 12:26:25 +0200
committerJuri Lelli <juri.lelli@gmail.com>2013-10-04 12:26:25 +0200
commit412ae6e9c66cf1a7ca5d6b17d9fe09c21ce65aef (patch)
tree5e33b619ed75548ba99714b9cdbb4b5ea7fd3d67
parent4284ebd7db18dc154b27a3cef67949f9db9d156c (diff)
Create PI-enabled mutexes
-rw-r--r--src/rt-app_parse_config.c6
-rw-r--r--src/rt-app_types.h1
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;