1 | // listener: voidfunc(S, O) or func(S, O) |
2 | static <A> AutoCloseable vmBus_addListener_basic(S msg, O listener) { |
3 | Map<S, Set> map = vm_busListenersByMessage_live(); |
4 | synchronized(map) { |
5 | Set listeners = map.get(msg); |
6 | if (listeners == null) map.put(msg, listeners = syncIdentityHashSet()); |
7 | // We're technically violating the one-synchronized-object-per-thread rule, |
8 | // but it should be OK here. |
9 | // TODO: remove empty sets from map |
10 | ret tempAdd(listeners, listener); |
11 | } |
12 | } |
Began life as a copy of #1018419
download show line numbers debug dex old transpilations
Travelled to 7 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1022182 |
Snippet name: | vmBus_addListener_basic |
Eternal ID of this version: | #1022182/4 |
Text MD5: | 8fa8466c479fb8a5e3b1e9f4ffe77250 |
Author: | stefan |
Category: | javax / vm |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-03-10 14:18:06 |
Source code size: | 504 bytes / 12 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 285 / 336 |
Version history: | 3 change(s) |
Referenced in: | [show references] |