libmicrohttpd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libmicrohttpd] Race condition


From: Markus Doppelbauer
Subject: [libmicrohttpd] Race condition
Date: Sat, 27 Jun 2015 19:25:24 +0200

Hello,

I think there is a race condition and I have no clue how to fix it:

Main-Thread calls "MHD_quiesce_daemon()"
Main-Thread sleeps until last connection is closed
Poll-Thread wakes up the Main-Thread from "MHD_OPTION_NOTIFY_CONNECTION"
    because of "MHD_CONNECTION_NOTIFY_CLOSED"
Main-Thread calls "MHD_get_daemon_info(MHD_DAEMON_INFO_CURRENT_CONNECTIONS)"
    and gets "1 connection"
Poll-Thread removes the connection-struct
Main-Thread sleeps forever (there are "0 connections" now)

Would it be possible to call "MHD_CONNECTION_NOTIFY_CLOSED" after decrement
of the daemon-connection-counter?

Thanks a lot
Markus




reply via email to

[Prev in Thread] Current Thread [Next in Thread]