[systemd-devel] Using eventloop from pthread while using sd-bus functions in main threads causes deadlock or corruption

Lennart Poettering lennart at poettering.net
Wed Jun 8 12:31:10 UTC 2016


On Wed, 08.06.16 08:49, Ben-melech, Shiran (shiran.ben-melech at intel.com) wrote:

> Thank you for the help, I've found that my mistake was initializing the
> sd_event from the main thread while running the loop from the pthread.
> now everything seems to be in order.
> 
> Is there a way to cancel the event loop from the main thread without
> killing the pthread?

Consider creating an eventfd() and adding it to the event loop while
attaching a function that just quits the loop. Then, simply write
something to the eventfd and the event loop will exit.

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list