int main(){
//If you change numIterations to 1025, the program freezes
int numIterations = 1023;
int sizeOfArr = 1024; aeron::driver::concurrent::OneToOneConcurrentArrayQueue<byte*> queue(sizeOfArr); byte* arr = new byte [sizeOfArr]; byte** arrPtr = &arr;
for(int i = 0; i < numIterations; ++i){ queue.offer(arrPtr)
while((arrPtr = queue.poll()) == nullptr){ cout << "In poll loop" << endl; }
//Not get optimized away for(int k = 0; k < sizeOfArr; ++k){ (*arrPtr)[k] = (*arrPtr)[k] + 1; } }}
public class QueueTester {
public static void main(String[] args) {
int sizeOfArray = 1024;
final Queue<byte[]> queue = new OneToOneConcurrentArrayQueue<byte[]>(1024);
byte[] arr = new byte[sizeOfArray];
for (int i = 0; i < 10000; i++) {
queue.offer(arr)
while ((arr = queue.poll()) == null) {
System.out.println("In poll loop");
}
// Prevent Aggressive optimizations
for (int k = 0; k < sizeOfArray; k++) {
arr[k] = (byte) (arr[k] + 1);
}
}
}
}
--
You received this message because you are subscribed to the Google Groups "mechanical-sympathy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mechanical-symp...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.