+
+ /* wait for a modifiable event loop */
+ while (__atomic_load_n(&el->state, __ATOMIC_RELAXED) & EVLOOP_STATE_WAIT) {
+ x = 1;
+ write(el->efd, &x, sizeof x);
+ pthread_cond_wait(&el->cond, &mutex);
+ }
+
+ return el->sdev;
+}
+
+/**
+ * Gets a sd_event item for the current thread.
+ * @return a sd_event or NULL in case of error
+ */
+struct sd_event *jobs_get_sd_event()
+{
+ struct sd_event *result;
+
+ pthread_mutex_lock(&mutex);
+ result = get_sd_event_locked();
+ pthread_mutex_unlock(&mutex);
+
+ return result;
+}
+
+#if defined(REMOVE_SYSTEMD_EVENT)
+/**
+ * Gets the fdev_epoll item.
+ * @return a fdev_epoll or NULL in case of error
+ */
+struct fdev_epoll *jobs_get_fdev_epoll()
+{
+ struct fdev_epoll *result;
+
+ pthread_mutex_lock(&mutex);
+ result = get_fdevepoll();