wu-sheng commented on a change in pull request #4220: sniffer processing 
profile task and report status and snapshot
URL: https://github.com/apache/skywalking/pull/4220#discussion_r367272230
 
 

 ##########
 File path: 
apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/profile/ProfileTaskExecutionContext.java
 ##########
 @@ -58,4 +163,20 @@ public boolean equals(Object o) {
     public int hashCode() {
         return Objects.hash(task);
     }
+
+    private boolean tryToAttemptProfiling(TracingContext tracingContext, ID 
traceSegmentId, String firstSpanOPName, int currentUsingSlotCount) {
+        // try to occupy slot
+        if (!currentProfilingCount.compareAndSet(currentUsingSlotCount, 
currentUsingSlotCount + 1)) {
+            return false;
+        }
+
+        final ThreadProfiler segmentContext = new 
ThreadProfiler(tracingContext, traceSegmentId, Thread.currentThread(), this);
+        for (int slot = 0; slot < profilingSegmentSlots.length; slot++) {
+            if (profilingSegmentSlots[slot] == null) {
+                profilingSegmentSlots[slot] = segmentContext;
 
 Review comment:
   I think you missed the profilingSegmentSlots resign to make `volatile` works.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to