Added linking to threading library.

This will hopefully fix Linux builds.