fixing compilation on g++ by adding pthread dependency. also added include cstring in test code.