I am wondering how to protect global variables, such us pointers in a linked list, that are updated inside a callback and the possibility of re-entrant callbacks. In particular, I am dealing with chunked HTTP messages and the need inside a read callback to create other event buffers to initiate network I/O to POST to another server the chunks received. The application is single threaded.
Is there a real possibility for a single-threaded libevent application to re-enter a callback or is this something that in a single-threaded application will never happen? Please advise. Thanks, -Marco G.
|