Page 1 of 1

ThreadLocal.h

Posted: Fri Oct 12, 2018 4:50 am
by sam
Reposting as a single message -- had formatting issues with the prior otherwise identical post.


Guys,

Did something happen recently with ThreadLocal? I can't find ThreadLocal.h in the latest release of simbody (https://github.com/simbody/simbody.git ). I ask because I try to compile molmodel (which has not changed in forever) I get the below error. Where exactly is ThreadLocal.h?

thanks

sam

sam@pe1:~/svn/molmodel/build$ make
[ 3%] Building CXX object sharedTarget/CMakeFiles/SimTKmolmodel.dir/__/src/DuMMForceFieldSubsystemRep.cpp.o
/home/sam/svn/molmodel/src/DuMMForceFieldSubsystemRep.cpp:1759:5: error: ThreadLocal does not name a type; did you mean thread_local?
ThreadLocal Real localEnergy
thread_local
/home/sam/svn/molmodel/src/DuMMForceFieldSubsystemRep.cpp:1759:5: error: ThreadLocal does not name a type; did you mean thread_local?
ThreadLocal< Array_<Real, DuMM::NonbondAtomIndex> > localVdwScale;
^~~~~~~~~~~
thread_local

Re: ThreadLocal.h

Posted: Fri Oct 12, 2018 4:49 pm
by sherm
Hi, Sam. I think Chris Dembia removed that obsolete code a while back. I sent him an email requesting advice.

Best regards,
Sherm

Re: ThreadLocal.h

Posted: Fri Oct 12, 2018 5:23 pm
by chrisdembia
Sherm is correct. We removed that class template when removing the pthread dependency, since now we can use C++11 threads. See https://github.com/simbody/simbody/pull/587/files for how you can use C++11 `thread_local` instead. If you would prefer to continue using `SimTK::ThreadLocal`, you can copy it into your own project. You can obtain the header file here: https://github.com/simbody/simbody/blob ... eadLocal.h

Re: ThreadLocal.h

Posted: Sat Oct 13, 2018 4:27 am
by sam
Thanks guys!

yea i suspected that might be it but couldn't find anything about it in the github comments. maybe that was back in svn days and somehow i managed to void encountering this issue.