Commit Graph

26 Commits

Author SHA1 Message Date
Thad House
3d2f41d081 Adds a way to get the native handle from SafeThread (#198)
Useful to wpilib to enable easier changing of RT priorities.
2017-05-09 22:04:57 -07:00
Thad House
78995f5cca Fixes SetIntArrayRegion template for windows builds (#178) 2017-01-02 22:29:56 -08:00
Peter Johnson
df7d3261c9 JStringRef: ensure string is null terminated so c_str() works correctly. 2016-12-26 14:13:15 -08:00
Peter Johnson
c091d74de4 jni_util: Add JException wrapper class.
This allows more natural C++ Throw semantics (for a variety of string
data types) for any java exception that just takes a String argument.
2016-12-15 21:54:36 -08:00
Peter Johnson
8c2a148ed1 jni_util: Make JStringRef and JArrayRef null-safe.
They return empty string and empty array (to avoid crashes) but also
report an error with backtrace to stderr when called in that manner.
2016-12-14 23:59:06 -08:00
Peter Johnson
6fbaf57b99 jni_util: Add GetJavaStackTrace. 2016-12-14 23:59:02 -08:00
Peter Johnson
2df00647d5 Make JLocal and JArrayRef movable but non-copyable. 2016-12-14 23:29:23 -08:00
Peter Johnson
99395273c7 Fix JArrayRef DirectBuffer destructor.
Previously it would try to release array elements even if the DirectBuffer
constructor was used.
2016-12-14 23:29:23 -08:00
Peter Johnson
ce7611562f Make JClass more useful and use it in ntcore JNI. 2016-12-14 23:29:18 -08:00
Peter Johnson
1315a3967d NetworkStream: Add setBlocking() and getNativeHandle(). (#161)
Also add checking for "would block" errors in send() and receive().

Check for set nonblocking failures in TCPConnector as well (generate warnings rather than errors)
2016-11-27 19:59:52 -08:00
Thad House
38ec59f03a Adds a c_str method to StringRef (#155)
The StringRef class does not ensure the string is null terminated. As there is
no defined way to actually check for a null terminator, we determine
if it is null terminated based on the constructor type. Then if on c_str
it is not known to be null terminated, we use a passed in buffer to copy
the string and ensure null termination.
2016-11-14 22:51:52 -08:00
Peter Johnson
c23880f829 Make SafeThreadOwner moveable. (#153)
This allows it to be used in data structures such as std::vector.

Also make GetThread() const.
2016-11-11 22:18:52 -08:00
Thad House
dc94a3fac9 Adds a size parameter to JStringRef (#152)
Want to use that for some allwpilib JNI cleanups and potential bug fixes
2016-11-07 19:35:48 -08:00
Peter Johnson
34acd9d47c SafeThread: Use atomic for m_active. 2016-11-04 23:39:09 -07:00
Thad House
cf0ec7b9a9 Moves deprecation definition to wpiutil (#149) 2016-11-03 20:08:47 -07:00
Peter Johnson
d81840d6c6 raw_istream: Add std::istream style in_avail(). (#135) 2016-10-21 22:50:38 -07:00
Peter Johnson
f6df7cad9b Add raw_fd_istream. (#121) 2016-10-08 16:03:33 -07:00
Peter Johnson
1affae956b Make raw_socket_istream constructor explicit. 2016-09-25 19:48:49 -07:00
Peter Johnson
d3ed26f7cc Logger: Use raw_ostream and SmallString. 2016-09-25 19:48:49 -07:00
Peter Johnson
1ec89fc4f3 Add raw_socket_ostream.
This wraps NetworkStream in a llvm::raw_ostream.
2016-09-25 19:48:49 -07:00
Peter Johnson
de07b01a75 Add 1-character read to raw_istream. 2016-09-25 19:48:49 -07:00
Peter Johnson
c2ae897b02 Change API of raw_istream to be more similar to raw_ostream. 2016-09-25 19:48:49 -07:00
Peter Johnson
94c2b65798 Refactor JNI helpers into wpiutil (support/jni_util.h). (#105) 2016-09-25 19:29:17 -07:00
Peter Johnson
3a419768ca Make SafeThread header-only. (#117) 2016-09-25 18:21:29 -07:00
Peter Johnson
ee42448504 Update to latest LLVM code (#88)
* Update to latest LLVM code.

* Add LLVM's raw_ostream.

* MathExtras.h: Include cmath for log2.
2016-09-25 17:49:01 -07:00
Peter Johnson
f6b700ea97 Move common utility classes to wpiutil library. (#79)
This is a breaking change to dependencies that use the static ntcore
library.  Unless the wpiutil library is also linked, linker errors will
result.  This does not affect the shared ntcore library.
2016-09-25 17:23:39 -07:00