Commit Graph

20 Commits

Author SHA1 Message Date
Peter Johnson
d6d5321828 wpiutil UidVector: Implement clear() and forward iterator (#1293)
The forward iterator only iterates over "live" elements.

Also add a couple of unit tests for UidVector.
2018-08-24 20:39:57 -07:00
Peter Johnson
57490e0002 Add uv::AsyncFunction to do a roundtrip function call to a uv::Async
This optionally blocks to wait for a return value.
2018-08-20 22:21:53 -07:00
Peter Johnson
1de1900dbb Change uv::Async to accept data parameters
This is a breaking change as it makes Async a template (e.g. Async<> must
be used instead of just Async).  When data parameters are provided, an
internal mutex and vector is used to hold the parameter packs until the loop
runs.
2018-08-20 22:21:53 -07:00
Peter Johnson
4a3e43d4a7 Add HttpMultipartScanner (#1197)
This is a non-blocking version of FindMultipartBoundary.
2018-08-20 22:00:54 -07:00
Peter Johnson
82b25d0ec9 spinlock_bench.cpp: Fix wpiformat warning (#1282) 2018-08-19 17:25:20 -07:00
Peter Johnson
46ae19d082 wpiutil: Add a mutex-compatible spinlock implementation (#1272)
Note this is only faster than mutex if compiler optimization is enabled.
2018-08-19 01:01:10 -07:00
Peter Johnson
7fd7192b16 Disable UvGetAddrInfo Concurrent test on Windows (#1227)
This test likes to intermittently hang for some unknown reason, so disable it.
2018-07-27 21:41:04 -07:00
Peter Johnson
8aac46542d Add a SimpleBufferPool for uv::Buffer (#1215)
Buffers are reused on a regular basis in many use cases.
2018-07-25 00:58:54 -07:00
Peter Johnson
c25d48fd0c HttpParser: Add Reset() function (#1210)
This allows reuse of the HttpParser object for multiple requests.
2018-07-22 19:41:23 -07:00
Peter Johnson
297863b17a Add HttpParser and UrlParser C++ wrappers for http_parser. 2018-07-17 02:24:56 -07:00
Peter Johnson
e2314f3528 wpiutil: Add C++ libuv wrappers (#1166)
- Provide an EventLoopRunner to run uv::Loop on a separate thread.

- Add raw_ostream wrapper for uv::Buffer.
2018-07-17 01:06:24 -07:00
Peter Johnson
70960b0251 Signal: rename Signal to Signal_mt and Signal_st to Signal.
The single-threaded version is fine for most of the use cases we're planning
on, and is half the size on most platforms.
2018-06-30 00:21:09 -07:00
Peter Johnson
c8afe9bc2f Signal: Optimize to use plain std::function.
This optimizes the common case of a single simple callback (e.g. std::function
or lambda) so no additional allocation is required.  As a Connection return
value is not possible in this case, provide a separate connect_connection()
function to provide that.
2018-06-30 00:21:09 -07:00
Peter Johnson
876c650471 wpiutil: Add a signal-slot implementation. (#1163)
Imported from https://github.com/palacaze/sigslot

Classes were renamed from lowercase_me to UppercaseMe style, primarily
to avoid conflicting with the C standard library "signal" function.  They
were also moved to the "wpi::sig" namespace.
2018-06-27 23:01:17 -07:00
Peter Johnson
7cd15aa049 Re-enable JsonIteratorObjectTest.KeyValue. 2018-05-15 22:31:35 -07:00
Peter Johnson
f8ed48af98 Update json from upstream version 3.1.2.
This adds support for ubjson and makes a number of bugfixes.

Binary input and output have switched from strings to uint8_t arrays.
2018-05-15 22:31:35 -07:00
Tyler Veness
5ff3d837b6 Fix compilation with GCC 8 (#1051)
The anonymous namespace was renamed due to -Wsubobject-linkage complaining
about a field created in a GTest template class (CborRoundtripTestParam)
being defined in an anonymous namespace. See
https://stackoverflow.com/a/37723265.
2018-05-13 23:11:13 -07:00
Thad House
f07799c67b Disables unstable and failing unit tests (#1057) 2018-05-13 21:59:45 -07:00
Peter Johnson
f84018af5f Move entirety of llvm namespace to wpi namespace.
During shared library loading, a different libLLVM can be pulled in, causing
llvm symbols from dependent libraries to resolve to that library instead of
this one. This has been seen in the wild with the Mesa OpenGL implementation
in JavaFX applications (see wpilibsuite/shuffleboard#361).

This is clearly a very breaking change. For some level of backwards
compatibility, a namespace alias from llvm to wpi is performed in the "llvm"
headers.  Unfortunately, forward declarations of llvm classes will still break,
but compilers seem to generate clear error messages in those cases
("namespace alias 'llvm' not allowed here, assuming 'wpi'").

This change also moves all the wpiutil headers to a single "wpi" subdirectory
from the previously split "llvm", "support", "tcpsockets", and "udpsockets".
Shim headers will be added for backwards compatibility in a later commit.
2018-04-30 10:22:54 -07:00
Peter Johnson
0f947613a9 Prepare wpiutil for merge into allwpilib. 2018-04-27 19:56:51 -07:00