0002-Add-atomic-increment-to-informer_c96a85.patch
rsb-cil/Rsb/Informer.cs | ||
---|---|---|
1 | 1 |
using System; |
2 |
using System.Threading; |
|
2 | 3 |
using Rsb.Transport; |
3 | 4 |
using Rsb.Util; |
4 | 5 |
namespace Rsb |
... | ... | |
8 | 9 | |
9 | 10 |
private IConnector connector; |
10 | 11 |
private Guid id = Guid.NewGuid(); |
11 |
private long sequenceNumber = 1; // FIXME needs atomic increment
|
|
12 |
private long sequenceNumber = 1; |
|
12 | 13 | |
13 | 14 |
public Scope Scope |
14 | 15 |
{ |
... | ... | |
40 | 41 |
public void Send(Event theEvent) |
41 | 42 |
{ |
42 | 43 |
theEvent.EventId.ParticipantId = this.id; |
43 |
theEvent.EventId.SequenceNumber = sequenceNumber++;
|
|
44 |
theEvent.EventId.SequenceNumber = Interlocked.Increment(ref sequenceNumber);
|
|
44 | 45 |
this.connector.Push(theEvent); |
45 | 46 |
} |
46 | 47 | |
47 |
- |