First attempt to pthread integration