Previously this would always return false due to how explicit bool is
evaluated in a return context.
Also add a test for this function.
Reported by: jcreigh
This is safe because of the way writes are performed: for each transmission,
all outgoing messages are concatenated in memory and only a single write()
syscall is made.
These are good to have for backwards compatibility, but discouraged for new
development (default-taking functions should be used instead). The reason
is that the exceptions must be explicitly handled and may initially work but
then fail at an inopportune moment.
Mark the similar Java functions as deprecated as well for the same reason.
Update all the docs for consistency.
Mark overridden functions as such in both C++ and Java.
Make IsPersistent and GetFlags const in C++.
The Value::MakeStringArray methods were not setting the size of the
arr_string. This was causing the NT_Value struct called from the C
entry listener callback to not have the array size, which would then
cause the GetValueStringArray method to fail the malloc.
Under certain situations (notably JNI shutdown), it's possible to get
deadlock when using thread join(). To avoid this, implement a timeout.
Normally we try to simply join the thread, but if it times out, we
detach the thread instead.
This enables listeners to be notified of not only value updates, but also flag
changes and deletions by using a bitmask to specify what notifications are
desired. The old API (which only provided a new/not new) flag is still
supported. This also subsumes the feature to listen to local changes (that's
one of the bitmask options).
Before the server has assigned the id, the client doesn't generate flags
update messages. This behavior is correct, but the client must then send
the appropriate flags update message when the id is finally assigned by
the server.
The default behavior is to only notify remote changes, but for some
applications (e.g. GUI's) it's advantageous to know about local
changes as well.
This is (slightly) optimized in that local changes only result in
additional resources being consumed if (any) local listeners have been
created.
This matches the implementation provided by Java NetworkTable, with the
exception that the subtable is not provided (because it's not a value).
The listener still can get access to the subtable by calling
source->getSubTable(key).
The JVM doesn't always do a good job of telling JNI modules that the JVM
is going away, which results in a crash in the JavaGlobal and/or
JavaWeakGlobal destructors as they try to delete the associated references
after the JVM has already gone away.
To protect against this, the Notifier now has a static variable that's set
when the Notifier instance (a singleton) is destroyed. This is used by
JavaGlobal and JavaWeakGlobal to detect when a process exit is in process.
Previously they returned references to the strings/arrays within the passed
NT_Value, which is different from the GetEntry* functions and risks
double-frees.