diff --git a/gst/gstpoll.c b/gst/gstpoll.c
index 04165a5..40b9338 100644
--- a/gst/gstpoll.c
+++ b/gst/gstpoll.c
@@ -181,11 +181,17 @@ raise_wakeup (GstPoll * set)
 {
   gboolean result = TRUE;
 
+  /* makes testing control_pending and WAKE_EVENT() atomic. */
+  g_mutex_lock (&set->lock);
+
   if (g_atomic_int_add (&set->control_pending, 1) == 0) {
     /* raise when nothing pending */
     GST_LOG ("%p: raise", set);
     result = WAKE_EVENT (set);
   }
+
+  g_mutex_unlock (&set->lock);
+
   return result;
 }
 
@@ -195,12 +201,23 @@ raise_wakeup (GstPoll * set)
 static inline gboolean
 release_wakeup (GstPoll * set)
 {
-  gboolean result = TRUE;
+  gboolean result = FALSE;
+
+  /* makes testing/modifying control_pending and RELEASE_EVENT() atomic. */
+  g_mutex_lock (&set->lock);
 
-  if (g_atomic_int_dec_and_test (&set->control_pending)) {
-    GST_LOG ("%p: release", set);
-    result = RELEASE_EVENT (set);
+  if (g_atomic_int_get (&set->control_pending) > 0) {
+    /* release, only if this was the last pending. */
+    if (g_atomic_int_add (&set->control_pending, -1) == 1) {
+      GST_LOG ("%p: release", set);
+      result = RELEASE_EVENT (set);
+    }
+    else
+      result = TRUE;
   }
+
+  g_mutex_unlock (&set->lock);
+
   return result;
 }
 
@@ -209,6 +226,9 @@ release_all_wakeup (GstPoll * set)
 {
   gint old;
 
+  /* makes testing control_pending and RELEASE_EVENT() atomic. */
+  g_mutex_lock (&set->lock);
+
   while (TRUE) {
     if (!(old = g_atomic_int_get (&set->control_pending)))
       /* nothing pending, just exit */
@@ -224,6 +244,9 @@ release_all_wakeup (GstPoll * set)
         g_atomic_int_add (&set->control_pending, 1);
     }
   }
+
+  g_mutex_unlock (&set->lock);
+
   return old;
 }
 
@@ -568,9 +591,6 @@ gst_poll_new (gboolean controllable)
     if (socketpair (PF_UNIX, SOCK_STREAM, 0, control_sock) < 0)
       goto no_socket_pair;
 
-    fcntl (control_sock[0], F_SETFL, O_NONBLOCK);
-    fcntl (control_sock[1], F_SETFL, O_NONBLOCK);
-
     nset->control_read_fd.fd = control_sock[0];
     nset->control_write_fd.fd = control_sock[1];
 
