Don't attempt to log messages to a controller from a worker thread.
commitfd992deeea769721dc95bacb40ea360ef42f76dd
authorNick Mathewson <nickm@torproject.org>
Fri, 29 May 2009 14:18:50 +0000 (29 10:18 -0400)
committerNick Mathewson <nickm@torproject.org>
Sat, 30 May 2009 22:16:24 +0000 (30 18:16 -0400)
tree70e77957df737e808fd295696fb5b7ddce14fd11
parentd66c3797650698778bd098bbaf9d3bbeebfa9fcf
Don't attempt to log messages to a controller from a worker thread.

This patch adds a function to determine whether we're in the main
thread, and changes control_event_logmsg() to return immediately if
we're in a subthread.  This is necessary because otherwise we will
call connection_write_to_buf, which modifies non-locked data
structures.

Bugfix on 0.2.0.x; fix for at least one of the things currently
called "bug 977".
ChangeLog
src/common/compat.c
src/common/compat.h
src/common/util.c
src/or/control.c