Are NetworkTables listeners to different uncached topics guaranteed to be called in the order the topic's values are set? #6712
-
Are NetworkTables listeners to different uncached topics guaranteed to be called in the order the topic's values are set? For example, if server (or client) runs: inst.addListener(topic2.subscribe(""), EnumSet.of(Kind.kValueRemote), (event) -> {
System.out.println(event.valueData.value.getString());
});
inst.addListener(topic1.subscribe(""), EnumSet.of(Kind.kValueRemote), (event) -> {
System.out.println(event.valueData.value.getString());
}); and then client (or server) runs: topic1.setCached(false);
topic2.setCached(false);
topic1.publish().set("value1");
topic2.publish().set("value2");
inst.flush(); Is the server (or client) guaranteed to print:
? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
It should generally operate this way in the current implementation, but strict ordering is not guaranteed and you should not rely on this behavior. You can use timestamps (e.g. from getAtomic) to get a strict ordering, but structured data (in a single topic/update) may be a better choice depending on what you're trying to do. |
Beta Was this translation helpful? Give feedback.
It should generally operate this way in the current implementation, but strict ordering is not guaranteed and you should not rely on this behavior. You can use timestamps (e.g. from getAtomic) to get a strict ordering, but structured data (in a single topic/update) may be a better choice depending on what you're trying to do.