Test thread join functionality