summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGiacomo Bagnoli <g.bagnoli@asidev.com>2010-03-18 12:00:43 +0100
committerGiacomo Bagnoli <g.bagnoli@asidev.com>2010-03-18 12:00:43 +0100
commit4d39b523ebd32c40f280cb4a4fc2047f60864578 (patch)
tree5a55c94de686b2c3a310c539dcb0c9f196dfe385 /src
parentacb25dd1eeef436fe10fbc2b547b0cbeff92064c (diff)
Move "current" resource to the end of the access list, so that it will be locked last
Diffstat (limited to 'src')
-rw-r--r--src/rt-app_parse_config.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/rt-app_parse_config.c b/src/rt-app_parse_config.c
index 252671c..158cea5 100644
--- a/src/rt-app_parse_config.c
+++ b/src/rt-app_parse_config.c
@@ -246,7 +246,7 @@ parse_thread_resources(const rtapp_options_t *opts, struct json_object *locks,
int res_dur;
char res_name[4];
- rtapp_resource_access_list_t *tmp;
+ rtapp_resource_access_list_t *tmp, *head, *last;
char debug_msg[512], tmpmsg[512];
data->blockages = malloc(sizeof(rtapp_tasks_resource_list_t) *
@@ -265,13 +265,30 @@ parse_thread_resources(const rtapp_options_t *opts, struct json_object *locks,
serialize_acl(&data->blockages[i].acl, cur_res_idx,
task_resources, opts->resources);
+ /* since the "current" resource is returned as the first
+ * element in the list, we move it to the back */
+ tmp = data->blockages[i].acl;
+ head = data->blockages[i].acl;
+ do {
+ last = tmp;
+ tmp = tmp->next;
+ } while (tmp != NULL);
+ /* move first element to list end */
+ if (last != head) {
+ data->blockages[i].acl = head->next;
+ last->next = head;
+ head->next = NULL;
+ }
+
tmp = data->blockages[i].acl;
debug_msg[0] = '\0';
do {
snprintf(tmpmsg, 512, "%s %d", debug_msg, tmp->index);
strncpy(debug_msg, tmpmsg, 512);
+ last = tmp;
tmp = tmp->next;
} while (tmp != NULL);
+
log_debug(PIN "key: acl %s", debug_msg);
snprintf(res_name, 4, "%d", cur_res_idx);