[Tor-BSD] Building Tor 0.2.7.x on OpenBSD
teor
teor2345 at gmail.com
Mon Jul 27 19:58:06 EDT 2015
> On 28 Jul 2015, at 01:33 , attila <attila at stalphonsos.com> wrote:
>
> Signed PGP part
>
> attila <attila at stalphonsos.com> writes:
>
> …
> This patch below is a little better that the first one but
> in the end it's the same: call evthread_use_pthreads() on Unix. We
> ARE always using threads so there's no need to conditionalize it more
> than that, it's just the way that using_threads gets set to 1 is a
> little convoluted... whatever, not going to fix the world with one
> patch, just trying to make it incrementally better:
>
> Patch:
> ========================================================================
> diff --git a/configure.ac b/configure.ac
> index 214b7e6..963bb71 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -570,7 +570,12 @@ int x = y(zz);
> #else
> int x = 1;
> #endif
> - ])], [ AC_MSG_RESULT([yes]) ],
> + ])], [ AC_MSG_RESULT([yes])
> + TOR_LIBEVENT_LIBS="-levent_core -levent_extra"
> + if test "$bwin32" = "false"; then
> + TOR_LIBEVENT_LIBS="-levent_pthreads ${TOR_LIBEVENT_LIBS}"
> + fi
> + ],
> [ AC_MSG_RESULT([no])
> AC_MSG_ERROR([Libevent does not seem new enough to support bufferevents. We require 2.0.13-stable or later]) ] )
> fi
> diff --git a/src/common/compat_libevent.c b/src/common/compat_libevent.c
> index a366b6c..8dfeae2 100644
> --- a/src/common/compat_libevent.c
> +++ b/src/common/compat_libevent.c
> @@ -208,7 +208,11 @@ tor_libevent_initialize(tor_libevent_cfg *torcfg)
> }
> #elif defined(__COVERITY__)
> /* Avoid a 'dead code' warning below. */
> - using_threads = ! torcfg->disable_iocp;
> + /* N.B. To be clear: This piece of code is always compiled in on
> + * Unix when we are using libevent2. We are always using pthreads
> + * in this case. */
> + using_threads = ! torcfg->disable_iocp; /* disable_iocp defaults to 1 */
> + evthread_use_pthreads();
> #endif
>
> if (!using_threads) {
> ========================================================================
I can't see how this patch makes any difference, as the modified code is only compiled in under coverity.
You probably want something more like this (showing the full preprocessor block):
#if defined(_WIN32) && defined(USE_BUFFEREVENTS)
if (! torcfg->disable_iocp) {
evthread_use_windows_threads();
event_config_set_flag(cfg, EVENT_BASE_FLAG_STARTUP_IOCP);
using_iocp_bufferevents = 1;
using_threads = 1;
} else {
using_iocp_bufferevents = 0;
}
#elif defined(__COVERITY__)
/* Avoid a 'dead code' warning below. */
using_threads = ! torcfg->disable_iocp;
+#else /* is a libevent2 preprocessor conditional needed here? */
+ /* N.B. To be clear: This piece of code is always compiled in on
+ * Unix when we are using libevent2. We are always using pthreads
+ * in this case. */
+ evthread_use_pthreads();
#endif
Regards
Tim (teor)
Tim Wilson-Brown (teor)
teor2345 at gmail dot com
pgp ABFED1AC
https://gist.github.com/teor2345/d033b8ce0a99adbc89c5
teor at blah dot im
OTR D5BE4EC2 255D7585 F3874930 DB130265 7C9EBBC7
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://lists.nycbug.org/pipermail/tor-bsd/attachments/20150728/e2c1faf8/attachment.bin>
More information about the Tor-BSD
mailing list