In order to properly clean up all resources allocated by threads, we
need to join the non-detached threads. This is not possible within the
`sigaction` exit handler function. For this reason, the termination
logic is changed to use `sigwait`.
In addition, SIGALRM is added to the list of handled signals and
SIGUSR1, SIGUSR2 are ignored.
Signed-off-by: Maximilian Nitsch <maximilian.nitsch@d3tn.com>
Adds a parameter to the `hal_task_create()` function to allow
non-detached threads and a second parameter to pass the thread
identifier.
Signed-off-by: Maximilian Nitsch <maximilian.nitsch@d3tn.com>
This removes the parameters for task name, priority, and stack size,
which were mostly relevant for FreeRTOS on STM32.
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
`hal_task_create` returned a reference to the new task allocated on the
heap via `malloc`. We commonly used the pattern to `free` this reference
from the new thread which, however, could result in race conditions and
other synchronization issues. We added a fix using a semaphore in the
application agent, but this would have been needed in other places (CLA,
...) as well. As we do not make use of the task reference anywhere
besides in the CLA for error handling, we can remove the heap-allocated
value altogether and replace it with an `enum ud3tn_result` to simplify
things and circumvent the named synchronization issues.
In the case of the CLA function `cla_link_init`, logic is introduced to
request the RX task to exit immediately in case the TX task cannot be
launched.
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
ud3tn is available under multiple licenses and we want to reflect this in
our source code. But which license information should appear first and how
can we manage this efficiently in the future? The Linux Kernel uses SPDX
expressions instead of boilerplate sections. This seems to be a great
approach, so we do the same here.
Signed-off-by: Georg Alexander Murzik <georg.murzik@d3tn.com>
This is the initial commit for uD3TN. uD3TN is a fork of uPCN v0.8.0,
which will be developed and maintained in a public Git repository.
For questions concerning the history of and code provided with uPCN,
please get in touch with us via: contact <at> d3tn <dot> com
Signed-off-by: Felix Walter <felix.walter@d3tn.com>