Skip to content

Commit a5f70a3

Browse files
committed
Remove draft comments
1 parent 3eade6d commit a5f70a3

File tree

5 files changed

+18
-67
lines changed

5 files changed

+18
-67
lines changed

Disruptor/Disruptor.h

Lines changed: 12 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -308,20 +308,6 @@ namespace Disruptor
308308
m_ringBuffer->publishEvent(eventTranslator);
309309
}
310310

311-
///// <summary>
312-
///// Publish an event to the ring buffer.
313-
///// </summary>
314-
///// <param name="eventTranslator">the translator that will load data into the event</param>
315-
///// <param name="arg">A single argument to load into the event</param>
316-
//public void PublishEvent<A>(IEventTranslatorOneArg<T, A> eventTranslator, A arg) => _ringBuffer.PublishEvent(eventTranslator, arg);
317-
318-
///// <summary>
319-
///// Publish a batch of events to the ring buffer.
320-
///// </summary>
321-
///// <param name="eventTranslator">the translator that will load data into the event</param>
322-
///// <param name="arg">An array single arguments to load into the events. One Per event.</param>
323-
//public void PublishEvent<A>(IEventTranslatorOneArg<T, A> eventTranslator, A[] arg) => _ringBuffer.PublishEvents(eventTranslator, arg);
324-
325311
/// <summary>
326312
/// Starts the event processors and returns the fully configured ring buffer.
327313
///
@@ -407,28 +393,28 @@ namespace Disruptor
407393
return m_ringBuffer;
408394
}
409395

410-
///// <summary>
411-
///// Get the value of the cursor indicating the published sequence.
412-
///// </summary>
396+
/// <summary>
397+
/// Get the value of the cursor indicating the published sequence.
398+
/// </summary>
413399
std::int64_t cursor() const
414400
{
415401
return m_ringBuffer->cursor();
416402
}
417403

418-
///// <summary>
419-
///// The capacity of the data structure to hold entries.
420-
///// </summary>
404+
/// <summary>
405+
/// The capacity of the data structure to hold entries.
406+
/// </summary>
421407
std::int64_t bufferSize() const
422408
{
423409
return m_ringBuffer->bufferSize();
424410
}
425411

426-
///// <summary>
427-
///// Get the event for a given sequence in the RingBuffer.
428-
///// <see cref="RingBuffer{T}.this"/>
429-
///// </summary>
430-
///// <param name="sequence">sequence for the event</param>
431-
///// <returns>event for the sequence</returns>
412+
/// <summary>
413+
/// Get the event for a given sequence in the RingBuffer.
414+
/// <see cref="RingBuffer{T}.this"/>
415+
/// </summary>
416+
/// <param name="sequence">sequence for the event</param>
417+
/// <returns>event for the sequence</returns>
432418
T& operator[](std::int64_t sequence) const
433419
{
434420
return m_ringBuffer[sequence];

Disruptor/MultiProducerSequencer.h

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,7 @@ namespace Disruptor
4040
/// <returns>true if the buffer has the capacity to allocate the next sequence otherwise false.</returns>
4141
bool hasAvailableCapacity(std::int32_t requiredCapacity) override
4242
{
43-
//auto gatingSequences = std::atomic_load_explicit(&this->m_gatingSequences, std::memory_order_acquire);
44-
45-
//return hasAvailableCapacity(Volatile.Read(ref _gatingSequences), requiredCapacity, _cursor.Value);
4643
return hasAvailableCapacity(this->m_gatingSequences, requiredCapacity, this->m_cursor->value());
47-
//return hasAvailableCapacity(*gatingSequences, requiredCapacity, this->m_cursor->value());
4844
}
4945

5046
/// <summary>
@@ -100,14 +96,12 @@ namespace Disruptor
10096

10197
if (wrapPoint > cachedGatingSequence || cachedGatingSequence > current)
10298
{
103-
//auto gatingSequences = std::atomic_load_explicit(&this->m_gatingSequences, std::memory_order_acquire);
10499
std::int64_t gatingSequence = Util::getMinimumSequence(this->m_gatingSequences, current);
105-
//std::int64_t gatingSequence = Util::getMinimumSequence(*gatingSequences, current);
106100

107101
if (wrapPoint > gatingSequence)
108102
{
109103
this->m_waitStrategy->signalAllWhenBlocking();
110-
spinWait.spinOnce(); // LockSupport.parkNanos(1L);
104+
spinWait.spinOnce();
111105
continue;
112106
}
113107

@@ -154,10 +148,7 @@ namespace Disruptor
154148
current = this->m_cursor->value();
155149
next = current + n;
156150

157-
//auto gatingSequences = std::atomic_load_explicit(&this->m_gatingSequences, std::memory_order_acquire);
158-
159151
if (!hasAvailableCapacity(this->m_gatingSequences, n, current))
160-
//if (!hasAvailableCapacity(*gatingSequences, n, current))
161152
{
162153
DISRUPTOR_THROW_INSUFFICIENT_CAPACITY_EXCEPTION();
163154
}
@@ -172,13 +163,9 @@ namespace Disruptor
172163
/// </summary>
173164
std::int64_t getRemainingCapacity() override
174165
{
175-
//auto gatingSequences = std::atomic_load_explicit(&this->m_gatingSequences, std::memory_order_acquire);
176-
177-
//auto consumed = Util::getMinimumSequence(m_gatingSequences/*Volatile.Read(ref _gatingSequences)*/, m_cursor->value());
178166
auto consumed = Util::getMinimumSequence(this->m_gatingSequences, this->m_cursorRef.value());
179-
//auto consumed = Util::getMinimumSequence(*gatingSequences, this->m_cursor->value());
180167
auto produced = this->m_cursorRef.value();
181-
//auto produced = this->m_cursor->value();
168+
182169
return this->bufferSize() - (produced - consumed);
183170
}
184171

@@ -190,7 +177,6 @@ namespace Disruptor
190177
{
191178
setAvailable(sequence);
192179
this->m_waitStrategyRef.signalAllWhenBlocking();
193-
//this->m_waitStrategy->signalAllWhenBlocking();
194180
}
195181

196182
/// <summary>
@@ -203,7 +189,6 @@ namespace Disruptor
203189
setAvailable(l);
204190
}
205191
this->m_waitStrategyRef.signalAllWhenBlocking();
206-
//this->m_waitStrategy->signalAllWhenBlocking();
207192
}
208193

209194
/// <summary>
@@ -216,7 +201,6 @@ namespace Disruptor
216201
auto index = calculateIndex(sequence);
217202
auto flag = calculateAvailabilityFlag(sequence);
218203

219-
// return Volatile.Read(ref buffer[index]) == flag;
220204
return m_availableBuffer[index] == flag;
221205
}
222206

Disruptor/Sequence.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ namespace Disruptor
2121

2222
void Sequence::setValue(std::int64_t value)
2323
{
24-
//// no synchronization required, the CLR memory model prevents Store/Store re-ordering
2524
std::atomic_store_explicit(&m_fieldsValue, value, std::memory_order_release);
2625
}
2726

@@ -33,19 +32,16 @@ namespace Disruptor
3332
bool Sequence::compareAndSet(std::int64_t expectedSequence, std::int64_t nextSequence)
3433
{
3534
return std::atomic_compare_exchange_strong(&m_fieldsValue, &expectedSequence, nextSequence);
36-
//return Interlocked.CompareExchange(ref _fields.Value, nextSequence, expectedSequence) == expectedSequence;
3735
}
3836

3937
std::int64_t Sequence::incrementAndGet()
4038
{
4139
return std::atomic_fetch_add(&m_fieldsValue, std::int64_t(1)) + 1;
42-
//return Interlocked.Increment(ref _fields.Value);
4340
}
4441

4542
std::int64_t Sequence::addAndGet(std::int64_t value)
4643
{
4744
return std::atomic_fetch_add(&m_fieldsValue, value) + value;
48-
//return Interlocked.Add(ref _fields.Value, value);
4945
}
5046

5147
void Sequence::writeDescriptionTo(std::ostream& stream) const

Disruptor/SingleProducerSequencer.h

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,7 @@ namespace Disruptor
4949

5050
if (wrapPoint > cachedGatingSequence || cachedGatingSequence > nextValue)
5151
{
52-
//auto& gatingSequences = this->m_gatingSequences;
53-
//auto gatingSequences = std::atomic_load_explicit(&this->m_gatingSequences, std::memory_order_acquire);
54-
5552
auto minSequence = Util::getMinimumSequence(this->m_gatingSequences, nextValue);
56-
//auto minSequence = Util::getMinimumSequence(*gatingSequences, nextValue);
5753
m_fields.cachedValue = minSequence;
5854

5955
if (wrapPoint > minSequence)
@@ -105,17 +101,11 @@ namespace Disruptor
105101
{
106102
std::int64_t minSequence;
107103

108-
//auto& gatingSequences = this->m_gatingSequences;
109-
//auto gatingSequences = std::atomic_load_explicit(&this->m_gatingSequences, std::memory_order_acquire);
110-
111104
SpinWait spinWait;
112105
while (wrapPoint > (minSequence = Util::getMinimumSequence(this->m_gatingSequences, nextValue)))
113-
//while (wrapPoint > (minSequence = Util::getMinimumSequence(*gatingSequences, nextValue)))
114106
{
115107
this->m_waitStrategyRef.signalAllWhenBlocking();
116-
//this->m_waitStrategy->signalAllWhenBlocking();
117-
118-
spinWait.spinOnce(); // LockSupport.parkNanos(1L);
108+
spinWait.spinOnce();
119109
}
120110

121111
m_fields.cachedValue = minSequence;
@@ -167,12 +157,9 @@ namespace Disruptor
167157
{
168158
auto nextValue = m_fields.nextValue;
169159

170-
//auto& gatingSequences = this->m_gatingSequences;
171-
//auto gatingSequences = std::atomic_load_explicit(&this->m_gatingSequences, std::memory_order_acquire);
172-
173160
auto consumed = Util::getMinimumSequence(this->m_gatingSequences, nextValue);
174-
//auto consumed = Util::getMinimumSequence(*gatingSequences, nextValue);
175161
auto produced = nextValue;
162+
176163
return this->bufferSize() - (produced - consumed);
177164
}
178165

@@ -193,8 +180,6 @@ namespace Disruptor
193180
{
194181
this->m_cursorRef.setValue(sequence);
195182
this->m_waitStrategyRef.signalAllWhenBlocking();
196-
//this->m_cursor->setValue(sequence);
197-
//this->m_waitStrategy->signalAllWhenBlocking();
198183
}
199184

200185
/// <summary>
@@ -215,7 +200,6 @@ namespace Disruptor
215200
bool isAvailable(std::int64_t sequence) override
216201
{
217202
return sequence <= this->m_cursorRef.value();
218-
//return sequence <= this->m_cursor->value();
219203
}
220204

221205
/// <summary>

Disruptor/ThreadPerTaskScheduler.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
#include "ThreadPerTaskScheduler.h"
44

5+
56
namespace Disruptor
67
{
78

@@ -48,4 +49,4 @@ namespace Disruptor
4849
return result;
4950
}
5051

51-
}
52+
} // namespace Disruptor

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy