Commit graph

148 commits

Author SHA1 Message Date
Lewis Baker
5ea2225efe Use <experimental/filesystem> instead of <filesystem>
Clang's libc++ doesn't yet have a <filesystem> header.
2017-06-11 21:48:45 +09:30
Lewis Baker
2e7a0b6c03 Remove use of reinterpret_cast in constexpr expression. 2017-06-11 21:44:47 +09:30
Lewis Baker
8bca9697c2 Fix compilation errors in on_scope_exit/on_scope_failure. 2017-06-11 20:31:51 +09:30
Lewis Baker
5e3815929d Fix include-guard in cancellation_state.hpp 2017-06-11 20:19:31 +09:30
Lewis Baker
29ce3d2727 Avoid use of CALLBACK as template parameter name.
Windows.h defines CALLBACK as a macro which causes compile-errors
if included before the cancellation_registration.hpp header.
2017-06-11 20:17:52 +09:30
Lewis Baker
d269d1df27 Remove set_exception() methods from promise types.
MSVC 2015 isn't supported any more so we should be able to rely on
unhandled_exception() being supported.
2017-06-11 20:15:21 +09:30
Lewis Baker
479cb1c15c Update readme to indicate that only VS2017 is supported now.
Also clarify that it will use latest Windows SDK version rather
than just a specific one.
2017-06-01 23:05:26 +09:30
Lewis Baker
af6f2fbb5c Factored out logic for finding MSVC 2017 compiler to cake.
This simplifies the config.cake file a lot.
2017-06-01 22:59:32 +09:30
Lewis Baker
30817352c5 Add missing return in io_context::operator=(). 2017-05-30 21:25:44 +09:30
Lewis Baker
82e577ac82 Update to use doctest 1.2.1
Fixes compilation issue when mixing doctest.h with <thread>.
Removed some workarounds in some test source files.
2017-05-30 14:09:43 +09:30
Lewis Baker
4a34b948ed Add [[nodiscard]] to io_context/io_service::schedule(). 2017-05-27 21:33:22 +09:30
Lewis Baker
8cf10ce184 Add async file I/O support for Win32 platform.
- Adds file, readable_file, writable_file, read_only_file,
  write_only_file and read_write_file classes.
- Adds file_share_mode, file_open_mode, file_buffering_mode enums.
- Supports async read/write but only synchronous open for now.
- Removes support for VS 2015 since implementation makes use of
  std::optional which is only available in VS 2017.
2017-05-27 21:26:59 +09:30
Lewis Baker
91e9b039b2 Added io_service/io_context scheduler using Win32 IO completion ports. 2017-05-27 09:28:39 +09:30
Lewis Baker
fc5e9ef844 Add cppcoro::on_scope_exit/on_scope_failure/on_scope_success helpers. 2017-05-27 07:00:01 +09:30
Lewis Baker
bb3fba0aa7 Add .pyc files to .gitignore 2017-05-23 08:03:16 +09:30
Lewis Baker
de9e121af4 Update build system to run tests as part of the build.
Adds a new UnitTestTool for cake which can be used in scripts to launch
tests and record their output.
2017-05-23 08:02:17 +09:30
Lewis Baker
5063b77ca3 Skip running some shared_lazy_task tests under VS2015 x86 optimised.
They were crashing with an access violation due to what seems to be
a compiler bug that generates bad code.
2017-05-23 07:51:27 +09:30
Lewis Baker
9a620aa4c5 Change tests to use doctest testing framework.
Break out tests to separate files per abstraction.
2017-05-22 06:34:19 +09:30
Lewis Baker
5e01767869 Update config.cake with support for using experimental MSVC compiler. 2017-05-17 22:31:30 +09:30
Lewis Baker
f7bfad1c50 Add cppcoro::async_generator<T> 2017-05-17 22:11:03 +09:30
Lewis Baker
49eb9d62b5 Conditionally disable set_exception() methods for newer MSVC versions.
Newer MSVC versions complain if you have both unhandled_exception()
and set_exception() defined on your promise_type.
2017-05-17 21:37:18 +09:30
Lewis Baker
7a2ce5895b Add shared_lazy_task<T> class. 2017-05-08 09:04:42 +09:30
Lewis Baker
fbb2a93af7 Reduce iteration count of cancelation_registration perf test by 10x.
The test was taking too long under debug builds.
2017-05-07 22:36:11 +09:30
Lewis Baker
618ed37f6b Better-delineate groups of tests with a comment. 2017-05-07 22:33:42 +09:30
Lewis Baker
10fc3b1ecd Fix cppcoro::make_shared_task() for task<void> case.
Work around bug in MSVC by providing special-case overload of
make_shared_task() for task<void>. Add test for this.
2017-05-07 22:30:56 +09:30
Lewis Baker
e51997c21d Uncomment and conditionally-compile out test that fails on MSVC.
This way at least it should start running again if compiler is
upgraded or we use a different compiler (eg. clang).
2017-05-05 22:48:14 +09:30
Lewis Baker
4a1f378e5a Update README with some cancellation_token docs. 2017-05-05 22:46:52 +09:30
Lewis Baker
978b0a3b0d Add note about cancellation_registration callbacks throwing exceptions. 2017-05-05 22:45:39 +09:30
Lewis Baker
9007c7bf92 Make cancellation_registration more efficient.
Now keeps track of approximate number of free slots in a registration
chunk so that entire chunks can often be skipped when scanning for
free slots. Also, starts scanning at a position within the chunk based
on the number of free slots. This should handle typical LIFO cases
more efficiently when accessed from a single thread.

Ideas have been borrowed from .NET CancellationToken implementation.
2017-05-05 22:45:38 +09:30
Lewis Baker
d04f152bf9 Initial version of cancellation_token. 2017-05-02 07:46:09 +09:30
Lewis Baker
b8ada4773b Add test for number of constructor calls used to capture coroutine args.
Check that it only calls move-constructor once for each captured
argument to a function. Test is currently commented out as it fails
on MSVC 2017.1 compiler.
2017-04-25 21:54:20 +09:30
Lewis Baker
5710f40f08 Add cppcoro::shared_task<T>. 2017-04-25 21:48:59 +09:30
Lewis Baker
946d794f9f Implement move-assignment for task<T> and lazy_task<T>. 2017-04-22 09:09:58 +09:30
Lewis Baker
02188fe727 Add some missing headers to generated .vcproj file. 2017-04-21 22:28:49 +09:30
Lewis Baker
0f6a170475 Add support for building with Visual Studio 2017. 2017-04-20 22:25:32 +09:30
Lewis Baker
ea7e5dc435 Undefine NDEBUG in test/main.cpp so asserts are always enabled.
This should allow asserts to be tested under optimised build variants.
2017-04-19 22:29:09 +09:30
Lewis Baker
9b1b6024f4 Add cppcoro::async_mutex. 2017-04-19 22:14:21 +09:30
Lewis Baker
874a8db8f7 Add links to some issues from README 2017-04-17 11:57:27 +09:30
Lewis Baker
edcf02e222 Comment-out dependency on cppcoro.lib in use.cake until needed.
cppcoro.lib doesn't currently have any sources.
2017-04-17 08:54:24 +09:30
Lewis Baker
b21103196c Turn off incremental linking for optimised VS2015 builds. 2017-04-17 08:53:24 +09:30
Lewis Baker
484dc9938e Expand the content of the README. 2017-04-17 08:45:09 +09:30
Lewis Baker
96928055ba Add lazy_task<T>. 2017-04-04 21:30:49 +09:30
Lewis Baker
996e4ee8fa Add copyright headers to source files. 2017-04-02 09:44:53 +09:30
Lewis Baker
12ba2c4567 Add initial build system based on cake.
Supports building using VS 2015 compiler and generating .vcproj files
for Visual Studio 2015.
2017-04-01 22:09:04 +10:30
Lewis Baker
bbd41b0702 Add cppcoro::task<T> and cppcoro::single_consumer_event.
Includes a few tests for basic functionality of task<T>.
2017-04-01 22:02:33 +10:30
Lewis Baker
e6560707c8 Add tools/cake submodule. 2017-03-21 21:18:37 +10:00
Lewis Baker
006d46cd83 Add cake submodule. 2017-03-20 21:06:30 +10:00
Lewis Baker
8e61fcfaa3 Add license and skeleton readme. 2017-03-20 20:54:41 +10:00