diff options
author | Sreeharsha Ramanavarapu <sreeharsha.r@gmail.com> | 2021-01-08 09:59:17 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-08 13:29:17 +0900 |
commit | 17d1aeda18046f2b7225075d121ed54605a5adb9 (patch) | |
tree | d98e7d7995f5cc25e1dd1801a5bf2afca6449b5a /include | |
parent | 22715aeceaa81ace2c832312529bde3a42d0814f (diff) | |
download | DLT-daemon-17d1aeda18046f2b7225075d121ed54605a5adb9.tar.gz |
dlt_client_main_loop running in an infinite loop restricts graceful exit of DLT Client code (#284)
Issue:
------
dlt_client_main_loop currently uses an infinite loop ("while (1)"). This
creates problems when a DLT client is running in a thread as part of a larger
application. Graceful exit (for example: during object destruction) is not
possible because a thread is running dlt_client_main_loop in the background.
It is also not possible to exit the client, if we want it to fetch only a
pre-decided number of messages.
Solution:
---------
Allow user to define a callback function to check whether the next message
should be fetched.
dlt-test-client.c has a new option to fetch a pre-decided number of messages,
after which the client will exit.
Signed-off-by: Sreeharsha Ramanavarapu <sreeharsha.r@gmail.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/dlt/dlt_client.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/include/dlt/dlt_client.h b/include/dlt/dlt_client.h index f649b83..77f0cee 100644 --- a/include/dlt/dlt_client.h +++ b/include/dlt/dlt_client.h @@ -75,6 +75,7 @@ # include "dlt_types.h" # include "dlt_common.h" +#include <stdbool.h> typedef enum { @@ -104,6 +105,7 @@ extern "C" { # endif void dlt_client_register_message_callback(int (*registerd_callback)(DltMessage *message, void *data)); +void dlt_client_register_fetch_next_message_callback(bool (*registerd_callback)(void *data)); /** * Initialising dlt client structure with a specific port |