belliottsmith commented on code in PR #4869:
URL: https://github.com/apache/cassandra/pull/4869#discussion_r3373075999


##########
src/java/org/apache/cassandra/concurrent/SEPExecutor.java:
##########
@@ -123,18 +123,9 @@ protected <T extends Runnable> T addTask(T task)
         // we add to the queue first, so that when a worker takes a task 
permit it can be certain there is a task available
         // this permits us to schedule threads non-spuriously; it also means 
work is serviced fairly
         tasks.add(task);
-        int taskPermits;
-        while (true)
-        {
-            long current = permits.get();
-            taskPermits = taskPermits(current);
-            // because there is no difference in practical terms between the 
work permit being added or not (the work is already in existence)
-            // we always add our permit, but block after the fact if we 
breached the queue limit
-            if (permits.compareAndSet(current, updateTaskPermits(current, 
taskPermits + 1)))
-                break;
-        }
 
-        if (taskPermits == 0)
+        long current = permits.getAndAdd(updateTaskPermits(0, 1));

Review Comment:
   maybe prev now, since we've already updated it this way?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to