Commit bb02de1
[C#] Use event delegate for thread-safe, insertion-ordered event handler dispatch (#624)
* Initial plan
* Use event delegate composition for thread-safe, insertion-ordered handler dispatch
Replace HashSet<SessionEventHandler> with a private event (multicast delegate).
The compiler-generated add/remove accessors use a lock-free CAS loop,
dispatch reads the field once for an inherent snapshot, and invocation
order matches registration order.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: Stephen Toub <stoub@microsoft.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent 7cc50b6 commit bb02de1
1 file changed
+12
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
47 | | - | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
48 | 54 | | |
49 | 55 | | |
50 | 56 | | |
| |||
243 | 249 | | |
244 | 250 | | |
245 | 251 | | |
246 | | - | |
247 | | - | |
| 252 | + | |
| 253 | + | |
248 | 254 | | |
249 | 255 | | |
250 | 256 | | |
| |||
256 | 262 | | |
257 | 263 | | |
258 | 264 | | |
259 | | - | |
260 | | - | |
261 | | - | |
262 | | - | |
263 | | - | |
| 265 | + | |
| 266 | + | |
264 | 267 | | |
265 | 268 | | |
266 | 269 | | |
| |||
550 | 553 | | |
551 | 554 | | |
552 | 555 | | |
553 | | - | |
| 556 | + | |
554 | 557 | | |
555 | 558 | | |
556 | 559 | | |
| |||
0 commit comments