| summaryrefslogtreecommitdiff | 
diff options
| author | Nathanael Sensfelder <SpamShield0@MultiAgentSystems.org> | 2019-12-26 18:32:26 +0100 | 
|---|---|---|
| committer | Nathanael Sensfelder <SpamShield0@MultiAgentSystems.org> | 2019-12-26 18:32:26 +0100 | 
| commit | 4a9df9b604cec6ee4b4a6f01ef940443583f7573 (patch) | |
| tree | 0f455bf9c07bb598f2701be0a61f1c3b3b512db2 /src/server/communication_thread.c | |
| parent | 390576c3839ee7abb845e27b7267de45495e6b2f (diff) | |
Still working on the daemonization (and rewrite).
I am not sure that what I am doing is going to provide what was
requested in https://github.com/nsensfel/relabsd/issues/3 but it will at
the very least turn relabsd into a proper daemon, and the additions will
help create some kind of relabsd device manager if someone needs such a
thing.
Diffstat (limited to 'src/server/communication_thread.c')
| -rw-r--r-- | src/server/communication_thread.c | 55 | 
1 files changed, 55 insertions, 0 deletions
| diff --git a/src/server/communication_thread.c b/src/server/communication_thread.c new file mode 100644 index 0000000..2ed1aae --- /dev/null +++ b/src/server/communication_thread.c @@ -0,0 +1,55 @@ +/**** POSIX *******************************************************************/ +#include <pthread.h> +#include <string.h> + +/**** RELABSD *****************************************************************/ +#include <relabsd/debug.h> + +/******************************************************************************/ +/**** LOCAL FUNCTIONS *********************************************************/ +/******************************************************************************/ +void main_loop (struct relabsd_server server [const static 1]) +{ + +} + +void * posix_main_loop (void * params) +{ +   main_loop((struct relabsd_server *) params); + +   return NULL; +} + +/******************************************************************************/ +/**** EXPORTED FUNCTIONS ******************************************************/ +/******************************************************************************/ + +int relabsd_server_create_communication_thread +( +   struct relabsd_server server [const static 1] +) +{ +   int err; + +   err = +      pthread_create +      ( +         &(server->communication_thread), +         (const pthread_attr_t *) NULL, +         posix_main_loop, +         (void *) server +      ); + +   if (err != 0) +   { +      RELABSD_FATAL +      ( +         "Unable to create the communication thread: %s", +         strerror(err) +      ); + +      return -1; +   } + +   return 0; +} | 


