comparison Implab/Parallels/AsyncQueue.cs @ 227:8d5de4eb9c2c v2

Reimplemented JsonXmlReader, added support for null values: JSON null values are mapped to empty nodes with 'xsi:nil' attribute set to 'true'
author cin
date Sat, 09 Sep 2017 03:53:13 +0300
parents 238e15580926
children d6fe09f5592c
comparison
equal deleted inserted replaced
226:9428ea36838e 227:8d5de4eb9c2c
383 return; 383 return;
384 384
385 if (next == null) { 385 if (next == null) {
386 386
387 if (first != Interlocked.CompareExchange(ref m_last, null, first)) { 387 if (first != Interlocked.CompareExchange(ref m_last, null, first)) {
388 /*while (first.next == null)
389 Thread.MemoryBarrier();*/
390 388
391 // race 389 // race
392 // someone already updated the tail, restore the pointer to the queue head 390 // someone already updated the tail, restore the pointer to the queue head
393 m_first = first; 391 m_first = first;
394 } 392 }
395 // the tail is updated 393 // the tail is updated
396 } 394 }
397
398 // we need to update the head
399 //Interlocked.CompareExchange(ref m_first, next, first);
400 // if the head is already updated then give up
401 //return;
402
403 } 395 }
404 396
405 public void Clear() { 397 public void Clear() {
406 // start the new queue 398 // start the new queue
407 var chunk = new Chunk(DEFAULT_CHUNK_SIZE); 399 var chunk = new Chunk(DEFAULT_CHUNK_SIZE);