--
You received this message because you are subscribed to the Google Groups "Cap'n Proto" group.
To unsubscribe from this group and stop receiving emails from it, send an email to capnproto+...@googlegroups.com.
Visit this group at http://groups.google.com/group/capnproto.
I don't suppose you want to make a doc tarball for 0.4.1 in additionto the c++ tarball?
capnproto-doc and stick it in /usr/share/doc :)The same thing that's online, so distros can package it as
I've removed the global constructors and simplified it to support unowned pointers only. Here is the new diff:
Note, I had to change the macros to include the variable name - this is so that they can be initialised to nullptr when using __thread or thread_local storage specifiers, and default constructed when using ThreadLocal<T>.
One thing I'm not too happy with is that you only get one distinct thread local per template instantiation. Currently each of the usages of ThreadLocal is instantiated with a different type, so it works at the moment, but is fragile. I've added a second int template parameter which could be used to distinguish multiple thread locals of the same type - however this relies on the developer choosing unique ids for each declaration. Do you have any thoughts on how to improve this?
On Mon, Mar 10, 2014 at 6:38 AM, Jason Choy <jjw...@gmail.com> wrote:
I've removed the global constructors and simplified it to support unowned pointers only. Here is the new diff:Looking more into it, I think the use of pthread_once is unnecessary as a static local is required to be initialized in a thread-safe manner under C++11. Unless the iOS compiler is flagrantly in violation of the standard here, there should be no need to muck with pthread_once.
Note, I had to change the macros to include the variable name - this is so that they can be initialised to nullptr when using __thread or thread_local storage specifiers, and default constructed when using ThreadLocal<T>.
I think another solution is to declare the constructor-from-nullptr as "constexpr", in which case the compiler is smart enough not to emit a global constructor. I'm going to try this.One thing I'm not too happy with is that you only get one distinct thread local per template instantiation. Currently each of the usages of ThreadLocal is instantiated with a different type, so it works at the moment, but is fragile. I've added a second int template parameter which could be used to distinguish multiple thread locals of the same type - however this relies on the developer choosing unique ids for each declaration. Do you have any thoughts on how to improve this?
I'm going to try a trick where I declare a one-off type just to use as a template parameter.
Out of curiosity, what technique did you use to verify that the compiler didn't need to generate a global constructor?
I've put together a release candidate for 0.4.1. Can you please verify that this works with iOS? I'm not set up for testing against it.
Also, do you mind if I ask you to test future release candidates, when they happen?