Multi threading


I’m toying around with the mongoose library and copied the multi-threaded example but I have a question
about that: Why is the fn_data pointer of the mg_connection used to store the socket from the socketpair this means
that you cannot have any user context when using this solution. Looking at the definition in net.h is states:

void *fn_data; // User-specified function parameter

Wouldn’t it be better to add an extra variable to the mg_connection which lets say is called sockfd or so that can
contain this information. Am I also correct that with the mg_socketpair I’m busy polling the socket ? e.g. the MG_EV_POLL
event is raised for every connection by mg_mgr_poll().