Simpler VERIFY_REQUEST macro in process.c
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Mon, 23 Jun 2014 21:14:06 +0000 (22:14 +0100)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Mon, 23 Jun 2014 21:40:27 +0000 (22:40 +0100)
src/main/process.c

index 71a3f37..ba3e52e 100644 (file)
@@ -108,24 +108,17 @@ static char const *child_state_names[REQUEST_CHILD_NUM_STATES] = {
                fr_event_insert(el, request_timer, request, \
                                &when, &request->ev);
 
-
-#ifdef HAVE_PTHREAD_H
-#undef VERIFY_REQUEST
-
-#if defined(WITH_VERIFY_PTR)
-#  define VERIFY_REQUEST(_x) if (pthread_equal(pthread_self(), _x->child_pid) != 0) verify_request(__FILE__, __LINE__, _x)
-#else
 /*
- *  Even if were building without WITH_VERIFY_PTR
- *  the pointer must not be NULL when these various macros are used
- *  so we can add some sneaky asserts.
+ *     We need a different VERIFY_REQUEST macro in process.c
+ *     To avoid the race conditions with the master thread
+ *     checking the REQUEST whilst it's being worked on by
+ *     the child.
  */
-#  define VERIFY_REQUEST(_x) rad_assert(_x)
-#endif
-
+#if defined(WITH_VERIFY_PTR) && defined(HAVE_PTHREAD_H)
+#  undef VERIFY_REQUEST
+#  define VERIFY_REQUEST(_x) if (pthread_equal(pthread_self(), _x->child_pid) != 0) verify_request(__FILE__, __LINE__, _x)
 #endif
 
-
 /**
  * @section request_timeline
  *