/*
- * Copyright (C) 2016, 2017, 2018 "IoT.bzh"
+ * Copyright (C) 2016-2019 "IoT.bzh"
* Author José Bollo <jose.bollo@iot.bzh>
*
* Licensed under the Apache License, Version 2.0 (the "License");
#include <sys/eventfd.h>
#include <systemd/sd-event.h>
-#include "fdev.h"
#if HAS_WATCHDOG
#include <systemd/sd-daemon.h>
#endif
unsigned state; /**< encoded state */
int efd; /**< event notification */
struct sd_event *sdev; /**< the systemd event loop */
- struct fdev *fdev; /**< handling of events */
struct thread *holder; /**< holder of the evloop */
};
{
struct thread *nh, *ct = current_thread;
- if (evloop.holder == ct) {
+ if (ct && evloop.holder == ct) {
nh = ct->nholder;
evloop.holder = nh;
if (nh)
if (evloop.holder)
return evloop.holder == ct;
+ if (!evloop.sdev)
+ return 0;
+
ct->nholder = NULL;
evloop.holder = ct;
return 1;
*/
static void thread_enter(volatile struct thread *me)
{
+ evloop_release();
/* initialize description of itself and link it in the list */
me->tid = pthread_self();
me->stop = 0;