save thread_routine return value

sometimes we need to know the thread_routine running status, (we know that according to return values)
i always working on centos + xfce platform, can anyone test this patch on windows ? thanks