PROTON-1771: [c] add missing lock around wake_if_inactive

Fixes a race condition discovered by threaderciser.c


Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/3e2f9b5f
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/3e2f9b5f
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/3e2f9b5f

Branch: refs/heads/master
Commit: 3e2f9b5f8164a6720740b49b72af6471b1081df9
Parents: 8a4fac6
Author: Alan Conway <acon...@redhat.com>
Authored: Thu Apr 5 17:57:49 2018 -0400
Committer: Alan Conway <acon...@redhat.com>
Committed: Thu Apr 12 16:23:13 2018 -0400

----------------------------------------------------------------------
 c/src/proactor/epoll.c | 2 ++
 1 file changed, 2 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/3e2f9b5f/c/src/proactor/epoll.c
----------------------------------------------------------------------
diff --git a/c/src/proactor/epoll.c b/c/src/proactor/epoll.c
index 8ff5831..752e6e0 100644
--- a/c/src/proactor/epoll.c
+++ b/c/src/proactor/epoll.c
@@ -1321,7 +1321,9 @@ void pn_proactor_connect2(pn_proactor_t *p, 
pn_connection_t *c, pn_transport_t *
     } else {
       psocket_gai_error(&pc->psocket, gai_error, "connect to ");
       notify = wake(&pc->context);
+      lock(&p->context.mutex);
       notify_proactor = wake_if_inactive(p);
+      unlock(&p->context.mutex);
     }
   }
   /* We need to issue INACTIVE on immediate failure */


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org
For additional commands, e-mail: commits-h...@qpid.apache.org

Reply via email to