PROTON-2337: epoll proactor - missing lock on variable increment, found by TSAN
diff --git a/c/src/proactor/epoll.c b/c/src/proactor/epoll.c
index 8c792e6..876c55a 100644
--- a/c/src/proactor/epoll.c
+++ b/c/src/proactor/epoll.c
@@ -2407,12 +2407,12 @@
   lock(&p->tslot_mutex);
   tslot_t * ts = find_tslot(p);
   unlock(&p->tslot_mutex);
-  ts->generation++;  // wrapping OK.  Just looking for any change
 
   lock(&p->sched_mutex);
   assert(ts->task == NULL || ts->earmarked);
   assert(ts->state == UNUSED || ts->state == NEW);
   ts->state = PROCESSING;
+  ts->generation++;  // wrapping OK.  Just looking for any change
 
   // Process outstanding epoll events until we get a batch or need to block.
   while (true) {