TLS, threads, and workers

Roger Dingledine arma at
Wed Sep 10 15:47:39 UTC 2003

On Sun, Sep 07, 2003 at 01:42:45PM -0400, Joel N. Weber II wrote:
> > But you can't pass sockets back and forth across processes; hence
> > threads seem smart.
> Is that really true?

Good point. I did some poking around, and you're right: man unix,
man cmsg.

You can pass file descriptors as ancillary messages on local (unix)
dgram sockets. "The passed file descriptors behave as like they have
been created with dup(2)."

UNPv1 indicates that this works for all Unices. And Win32 is already
different anyway, because of its threading/forking issues.

> (On the other hand, I suspect that passing the openssl state around,
> etc, makes this not something you actually want to do anyway.)

Yes, this does make this solution quite messy, even if the cmsg stuff
works beautifully (and who knows if it does). In any case, it's another
option to consider (and likely discard) when the time comes to make
a decision.


More information about the tor-dev mailing list