Re: [protobuf] protobuf 3 without threadlocal
On Mon, Jun 8, 2015 at 6:57 PM, Austin Schuh wrote: > Pull request sent. I felt a lot better putting the logic in > google/protobuf/stubs/platform_macros.h, so I put it there. > The NO_THREADLOCAL macro does not belong to platform_macros.h. It will not work either because common.h does not include platform_macros.h so we have to have a copy in common.h anyway. > > My platform is a very old version of Linux on an embedded box. I'm not > sure what to use for PLATFORM, but since I'm already re-creating the build > commands using bazel to integrate the compiler into my project, I am now > able to define GOOGLE_PROTOBUF_NO_THREADLOCAL myself and everything works. > > Is there any interest or plans for a set of bazel rules for the protobuf > library? > Protobuf will be supported by bazel natively. See https://github.com/google/bazel/issues/52 > > Thanks! > Austin > > On Mon, Jun 8, 2015 at 5:42 PM Feng Xiao wrote: > >> >> >> On Fri, Jun 5, 2015 at 7:02 PM, Austin Schuh >> 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 protobuf+unsubscr...@googlegroups.com. >>> To post to this group, send email to protobuf@googlegroups.com. >>> 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 protobuf+unsubscr...@googlegroups.com. To post to this group, send email to protobuf@googlegroups.com. Visit this group at http://groups.google.com/group/protobuf. For more options, visit https://groups.google.com/d/optout.
Re: [protobuf] protobuf 3 without threadlocal
Pull request sent. I felt a lot better putting the logic in google/protobuf/stubs/platform_macros.h, so I put it there. My platform is a very old version of Linux on an embedded box. I'm not sure what to use for PLATFORM, but since I'm already re-creating the build commands using bazel to integrate the compiler into my project, I am now able to define GOOGLE_PROTOBUF_NO_THREADLOCAL myself and everything works. Is there any interest or plans for a set of bazel rules for the protobuf library? Thanks! Austin On Mon, Jun 8, 2015 at 5:42 PM Feng Xiao wrote: > > > On Fri, Jun 5, 2015 at 7:02 PM, Austin Schuh > 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 protobuf+unsubscr...@googlegroups.com. >> To post to this group, send email to protobuf@googlegroups.com. >> 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 protobuf+unsubscr...@googlegroups.com. To post to this group, send email to protobuf@googlegroups.com. Visit this group at http://groups.google.com/group/protobuf. For more options, visit https://groups.google.com/d/optout.
Re: [protobuf] protobuf 3 without threadlocal
On Fri, Jun 5, 2015 at 7:02 PM, Austin Schuh 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 protobuf+unsubscr...@googlegroups.com. > To post to this group, send email to protobuf@googlegroups.com. > 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 protobuf+unsubscr...@googlegroups.com. To post to this group, send email to protobuf@googlegroups.com. Visit this group at http://groups.google.com/group/protobuf. For more options, visit https://groups.google.com/d/optout.
[protobuf] protobuf 3 without threadlocal
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. 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 protobuf+unsubscr...@googlegroups.com. To post to this group, send email to protobuf@googlegroups.com. Visit this group at http://groups.google.com/group/protobuf. For more options, visit https://groups.google.com/d/optout.