winpthreads: simplify the handle validity in pthread_check()

Signed-off-by: Liu Hao <lh_mouse@126.com>
diff --git a/mingw-w64-libraries/winpthreads/src/sched.c b/mingw-w64-libraries/winpthreads/src/sched.c
index bdd4301..df3c60e 100644
--- a/mingw-w64-libraries/winpthreads/src/sched.c
+++ b/mingw-w64-libraries/winpthreads/src/sched.c
@@ -95,12 +95,7 @@
   pv = __pth_gpointer_locked (t);
   if (pv->ended == 0)
     return 0;
-  if (!(pv->h) || pv->h == INVALID_HANDLE_VALUE)
-  {
-        return ESRCH;
-  }
-  else if (!GetHandleInformation(pv->h, &dwFlags))
-        return ESRCH;
+  CHECK_OBJECT(pv, ESRCH);
   return 0;
 }