The threads flag is more correct than specifying -lpthread directly