- evloop_on_efd_event();
- return 1;
-}
-
-/**
- * Gets a sd_event item for the current thread.
- * @return a sd_event or NULL in case of error
- */
-static struct sd_event *get_sd_event_locked()
-{
- int rc;
-
- /* creates the evloop on need */
- if (!evloop.sdev) {
- /* start the creation */
- evloop.state = 0;
- /* creates the eventfd for waking up polls */
- evloop.efd = eventfd(0, EFD_CLOEXEC|EFD_SEMAPHORE);
- if (evloop.efd < 0) {
- ERROR("can't make eventfd for events");
- goto error1;
- }
- /* create the systemd event loop */
- rc = sd_event_new(&evloop.sdev);
- if (rc < 0) {
- ERROR("can't make new event loop");
- goto error2;
- }
- /* put the eventfd in the event loop */
- rc = sd_event_add_io(evloop.sdev, NULL, evloop.efd, EPOLLIN, on_evloop_efd, NULL);
- if (rc < 0) {
- ERROR("can't register eventfd");
- sd_event_unref(evloop.sdev);
- evloop.sdev = NULL;
-error2:
- close(evloop.efd);
-error1:
- return NULL;
- }
- }
-
- /* acquire the event loop */
- evloop_acquire();
-
- return evloop.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;