diff options
-rw-r--r-- | doc/examples/example2.json | 2 | ||||
-rw-r--r-- | src/rt-app_parse_config.c | 5 |
2 files changed, 6 insertions, 1 deletions
diff --git a/doc/examples/example2.json b/doc/examples/example2.json index a1d9746..ff142c9 100644 --- a/doc/examples/example2.json +++ b/doc/examples/example2.json @@ -8,7 +8,7 @@ "instance" : 1, "loop" : -1, "run" : 1000, - "timer" : { "ref" : "tick", "period" : 10000 } + "timer" : { "ref" : "unique", "period" : 10000 } } } } diff --git a/src/rt-app_parse_config.c b/src/rt-app_parse_config.c index e062f79..b77a408 100644 --- a/src/rt-app_parse_config.c +++ b/src/rt-app_parse_config.c @@ -300,6 +300,7 @@ parse_thread_event_data(char *name, struct json_object *obj, event_data_t *data, const rtapp_options_t *opts) { rtapp_resource_t *rdata, *ddata; + char unique_name[22]; char *ref; int i; @@ -394,6 +395,10 @@ parse_thread_event_data(char *name, struct json_object *obj, if (!strncmp(name, "timer", strlen("timer"))) { ref = get_string_value_from(obj, "ref", TRUE, "unknown"); + if (!strcmp(ref, "unique")) { + snprintf(unique_name, sizeof(unique_name), "timer%lx", (long)(data)); + ref = unique_name; + } i = get_resource_index(ref, rtapp_timer, opts); data->res = i; |