ThreadLocal.h

Simbody is useful for internal coordinate and coarse grained molecule modeling, large scale mechanical models like skeletons, and anything else that can be modeled as bodies interconnected by joints, acted upon by forces, and restricted by constraints.
POST REPLY
User avatar
Samuel Flores
Posts: 189
Joined: Mon Apr 30, 2007 1:06 pm

ThreadLocal.h

Post by Samuel Flores » Fri Oct 12, 2018 4:50 am

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

User avatar
Michael Sherman
Posts: 806
Joined: Fri Apr 01, 2005 6:05 pm

Re: ThreadLocal.h

Post by Michael Sherman » Fri Oct 12, 2018 4:49 pm

Hi, Sam. I think Chris Dembia removed that obsolete code a while back. I sent him an email requesting advice.

Best regards,
Sherm

User avatar
Christopher Dembia
Posts: 506
Joined: Fri Oct 12, 2012 4:09 pm

Re: ThreadLocal.h

Post by Christopher Dembia » Fri Oct 12, 2018 5:23 pm

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

User avatar
Samuel Flores
Posts: 189
Joined: Mon Apr 30, 2007 1:06 pm

Re: ThreadLocal.h

Post by Samuel Flores » Sat Oct 13, 2018 4:27 am

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.

POST REPLY