On Fri, Jun 5, 2015 at 7:02 PM, Austin Schuh <[email protected]> wrote:

> I have a target which is old enough that it doesn't support thread local
> variables.  I'd like to build the protobuf3 libraries for it.
>
> It looks like all I need to do is trigger arena.h and arena.cc to use the
> version of thread_cache that is used by Android which
> uses pthread_key_create.  One way to do that would be to add
> a GOOGLE_PROTOBUF_NO_THREADLOCAL variable and use that.  I've got that
> working locally as a proof of concept.  I'd like to get a change upstreamed
> to support this use case.  How would you approach solving that?  I'll
> happily write the patch if it isn't too tricky.
>
I think we can change the definition in google/protobuf/stubs/common.h to
something like:

#if defined(ANDROID) || defined(IPHONE) ||
defined(SOME_OTHER_PLATFORM_WITHOUT_THREADLOCAL)
#define GOOGLE_PROTOBUF_NO_THREADLOCAL
#endif

#ifdef GOOGLE_PROTOBUF_NO_THREADLOCAL
class ThreadLocalStorage {
...
}
#endif

And also use this macro in arena.h/arena.cc as well.



>
> Thanks!
>
  Austin
>
> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/protobuf.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.

Reply via email to