Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unify experimental includes #171

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
30 changes: 15 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -714,15 +714,15 @@ namespace cppcoro
{
public:
bool await_ready() const noexcept;
bool await_suspend(std::experimental::coroutine_handle<> awaiter) noexcept;
bool await_suspend(cppcoro::coroutine_handle<> awaiter) noexcept;
void await_resume() const noexcept;
};

class async_mutex_scoped_lock_operation
{
public:
bool await_ready() const noexcept;
bool await_suspend(std::experimental::coroutine_handle<> awaiter) noexcept;
bool await_suspend(cppcoro::coroutine_handle<> awaiter) noexcept;
[[nodiscard]] async_mutex_lock await_resume() const noexcept;
};

Expand Down Expand Up @@ -836,7 +836,7 @@ namespace cppcoro
async_manual_reset_event_operation(async_manual_reset_event& event) noexcept;

bool await_ready() const noexcept;
bool await_suspend(std::experimental::coroutine_handle<> awaiter) noexcept;
bool await_suspend(cppcoro::coroutine_handle<> awaiter) noexcept;
void await_resume() const noexcept;
};
}
Expand Down Expand Up @@ -904,7 +904,7 @@ namespace cppcoro
async_auto_reset_event_operation(const async_auto_reset_event_operation& other) noexcept;

bool await_ready() const noexcept;
bool await_suspend(std::experimental::coroutine_handle<> awaiter) noexcept;
bool await_suspend(cppcoro::coroutine_handle<> awaiter) noexcept;
void await_resume() const noexcept;

};
Expand Down Expand Up @@ -1389,7 +1389,7 @@ namespace cppcoro
schedule_operation(static_thread_pool* tp) noexcept;

bool await_ready() noexcept;
bool await_suspend(std::experimental::coroutine_handle<> h) noexcept;
bool await_suspend(cppcoro::coroutine_handle<> h) noexcept;
bool await_resume() noexcept;

private:
Expand Down Expand Up @@ -1546,7 +1546,7 @@ namespace cppcoro
schedule_operation& operator=(const schedule_operation&) noexcept;

bool await_ready() const noexcept;
void await_suspend(std::experimental::coroutine_handle<> awaiter) noexcept;
void await_suspend(cppcoro::coroutine_handle<> awaiter) noexcept;
void await_resume() noexcept;
};

Expand All @@ -1560,7 +1560,7 @@ namespace cppcoro
timed_schedule_operation& operator=(timed_schedule_operation&&) = delete;

bool await_ready() const noexcept;
void await_suspend(std::experimental::coroutine_handle<> awaiter);
void await_suspend(cppcoro::coroutine_handle<> awaiter);
void await_resume();
};

Expand Down Expand Up @@ -1591,12 +1591,12 @@ Example:
#include <cppcoro/io_service.hpp>
#include <cppcoro/read_only_file.hpp>

#include <experimental/filesystem>
#include <cppcoro/filesystem.hpp>
#include <memory>
#include <algorithm>
#include <iostream>

namespace fs = std::experimental::filesystem;
namespace fs = cppcoro::filesystem;

cppcoro::task<std::uint64_t> count_lines(cppcoro::io_service& ioService, fs::path path)
{
Expand Down Expand Up @@ -1740,7 +1740,7 @@ namespace cppcoro
file_read_operation(file_read_operation&& other) noexcept;

bool await_ready() const noexcept;
bool await_suspend(std::experimental::coroutine_handle<> awaiter);
bool await_suspend(cppcoro::coroutine_handle<> awaiter);
std::size_t await_resume();

};
Expand All @@ -1752,7 +1752,7 @@ namespace cppcoro
file_write_operation(file_write_operation&& other) noexcept;

bool await_ready() const noexcept;
bool await_suspend(std::experimental::coroutine_handle<> awaiter);
bool await_suspend(cppcoro::coroutine_handle<> awaiter);
std::size_t await_resume();

};
Expand All @@ -1774,7 +1774,7 @@ namespace cppcoro
[[nodiscard]]
static read_only_file open(
io_service& ioService,
const std::experimental::filesystem::path& path,
const cppcoro::filesystem::path& path,
file_share_mode shareMode = file_share_mode::read,
file_buffering_mode bufferingMode = file_buffering_mode::default_);

Expand All @@ -1787,7 +1787,7 @@ namespace cppcoro
[[nodiscard]]
static write_only_file open(
io_service& ioService,
const std::experimental::filesystem::path& path,
const cppcoro::filesystem::path& path,
file_open_mode openMode = file_open_mode::create_or_open,
file_share_mode shareMode = file_share_mode::none,
file_buffering_mode bufferingMode = file_buffering_mode::default_);
Expand All @@ -1801,7 +1801,7 @@ namespace cppcoro
[[nodiscard]]
static read_write_file open(
io_service& ioService,
const std::experimental::filesystem::path& path,
const cppcoro::filesystem::path& path,
file_open_mode openMode = file_open_mode::create_or_open,
file_share_mode shareMode = file_share_mode::none,
file_buffering_mode bufferingMode = file_buffering_mode::default_);
Expand Down Expand Up @@ -2794,7 +2794,7 @@ coroutine.

A type that satisfies `Awaiter<T>` must have, for an instance of the type, `awaiter`:
- `awaiter.await_ready()` -> `bool`
- `awaiter.await_suspend(std::experimental::coroutine_handle<void>{})` -> `void` or `bool` or `std::experimental::coroutine_handle<P>` for some `P`.
- `awaiter.await_suspend(cppcoro::coroutine_handle<void>{})` -> `void` or `bool` or `cppcoro::coroutine_handle<P>` for some `P`.
- `awaiter.await_resume()` -> `T`

Any type that implements the `Awaiter<T>` concept also implements the `Awaitable<T>` concept.
Expand Down
6 changes: 3 additions & 3 deletions include/cppcoro/async_auto_reset_event.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#ifndef CPPCORO_ASYNC_AUTO_RESET_EVENT_HPP_INCLUDED
#define CPPCORO_ASYNC_AUTO_RESET_EVENT_HPP_INCLUDED

#include <experimental/coroutine>
#include <cppcoro/coroutine.hpp>
#include <atomic>
#include <cstdint>

Expand Down Expand Up @@ -80,7 +80,7 @@ namespace cppcoro
async_auto_reset_event_operation(const async_auto_reset_event_operation& other) noexcept;

bool await_ready() const noexcept { return m_event == nullptr; }
bool await_suspend(std::experimental::coroutine_handle<> awaiter) noexcept;
bool await_suspend(cppcoro::coroutine_handle<> awaiter) noexcept;
void await_resume() const noexcept {}

private:
Expand All @@ -89,7 +89,7 @@ namespace cppcoro

const async_auto_reset_event* m_event;
async_auto_reset_event_operation* m_next;
std::experimental::coroutine_handle<> m_awaiter;
cppcoro::coroutine_handle<> m_awaiter;
std::atomic<std::uint32_t> m_refCount;

};
Expand Down
52 changes: 26 additions & 26 deletions include/cppcoro/async_generator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include <atomic>
#include <iterator>
#include <type_traits>
#include <experimental/coroutine>
#include <cppcoro/coroutine.hpp>
#include <functional>
#include <cassert>

Expand Down Expand Up @@ -45,7 +45,7 @@ namespace cppcoro
async_generator_promise_base(const async_generator_promise_base& other) = delete;
async_generator_promise_base& operator=(const async_generator_promise_base& other) = delete;

std::experimental::suspend_always initial_suspend() const noexcept
cppcoro::suspend_always initial_suspend() const noexcept
{
return {};
}
Expand Down Expand Up @@ -89,7 +89,7 @@ namespace cppcoro

std::exception_ptr m_exception;

std::experimental::coroutine_handle<> m_consumerCoroutine;
cppcoro::coroutine_handle<> m_consumerCoroutine;

protected:

Expand All @@ -100,7 +100,7 @@ namespace cppcoro
{
public:

async_generator_yield_operation(std::experimental::coroutine_handle<> consumer) noexcept
async_generator_yield_operation(cppcoro::coroutine_handle<> consumer) noexcept
: m_consumer(consumer)
{}

Expand All @@ -109,8 +109,8 @@ namespace cppcoro
return false;
}

std::experimental::coroutine_handle<>
await_suspend([[maybe_unused]] std::experimental::coroutine_handle<> producer) noexcept
cppcoro::coroutine_handle<>
await_suspend([[maybe_unused]] cppcoro::coroutine_handle<> producer) noexcept
{
return m_consumer;
}
Expand All @@ -119,7 +119,7 @@ namespace cppcoro

private:

std::experimental::coroutine_handle<> m_consumer;
cppcoro::coroutine_handle<> m_consumer;

};

Expand All @@ -145,7 +145,7 @@ namespace cppcoro

async_generator_advance_operation(
async_generator_promise_base& promise,
std::experimental::coroutine_handle<> producerCoroutine) noexcept
cppcoro::coroutine_handle<> producerCoroutine) noexcept
: m_promise(std::addressof(promise))
, m_producerCoroutine(producerCoroutine)
{
Expand All @@ -155,8 +155,8 @@ namespace cppcoro

bool await_ready() const noexcept { return false; }

std::experimental::coroutine_handle<>
await_suspend(std::experimental::coroutine_handle<> consumerCoroutine) noexcept
cppcoro::coroutine_handle<>
await_suspend(cppcoro::coroutine_handle<> consumerCoroutine) noexcept
{
m_promise->m_consumerCoroutine = consumerCoroutine;
return m_producerCoroutine;
Expand All @@ -165,7 +165,7 @@ namespace cppcoro
protected:

async_generator_promise_base* m_promise;
std::experimental::coroutine_handle<> m_producerCoroutine;
cppcoro::coroutine_handle<> m_producerCoroutine;

};

Expand Down Expand Up @@ -242,7 +242,7 @@ namespace cppcoro
class async_generator_iterator final
{
using promise_type = async_generator_promise<T>;
using handle_type = std::experimental::coroutine_handle<promise_type>;
using handle_type = cppcoro::coroutine_handle<promise_type>;

public:

Expand Down Expand Up @@ -307,7 +307,7 @@ namespace cppcoro
class async_generator_begin_operation final : public async_generator_advance_operation
{
using promise_type = async_generator_promise<T>;
using handle_type = std::experimental::coroutine_handle<promise_type>;
using handle_type = cppcoro::coroutine_handle<promise_type>;

public:

Expand Down Expand Up @@ -358,7 +358,7 @@ namespace cppcoro
{}

explicit async_generator(promise_type& promise) noexcept
: m_coroutine(std::experimental::coroutine_handle<promise_type>::from_promise(promise))
: m_coroutine(cppcoro::coroutine_handle<promise_type>::from_promise(promise))
{}

async_generator(async_generator&& other) noexcept
Expand Down Expand Up @@ -408,7 +408,7 @@ namespace cppcoro

private:

std::experimental::coroutine_handle<promise_type> m_coroutine;
cppcoro::coroutine_handle<promise_type> m_coroutine;

};

Expand Down Expand Up @@ -451,7 +451,7 @@ namespace cppcoro
async_generator_promise_base(const async_generator_promise_base& other) = delete;
async_generator_promise_base& operator=(const async_generator_promise_base& other) = delete;

std::experimental::suspend_always initial_suspend() const noexcept
cppcoro::suspend_always initial_suspend() const noexcept
{
return {};
}
Expand Down Expand Up @@ -556,7 +556,7 @@ namespace cppcoro

std::exception_ptr m_exception;

std::experimental::coroutine_handle<> m_consumerCoroutine;
cppcoro::coroutine_handle<> m_consumerCoroutine;

protected:

Expand All @@ -579,7 +579,7 @@ namespace cppcoro
return m_initialState == state::value_not_ready_consumer_suspended;
}

bool await_suspend(std::experimental::coroutine_handle<> producer) noexcept;
bool await_suspend(cppcoro::coroutine_handle<> producer) noexcept;

void await_resume() noexcept {}

Expand Down Expand Up @@ -625,7 +625,7 @@ namespace cppcoro
}

inline bool async_generator_yield_operation::await_suspend(
std::experimental::coroutine_handle<> producer) noexcept
cppcoro::coroutine_handle<> producer) noexcept
{
state currentState = m_initialState;
if (currentState == state::value_not_ready_consumer_active)
Expand Down Expand Up @@ -711,7 +711,7 @@ namespace cppcoro

async_generator_advance_operation(
async_generator_promise_base& promise,
std::experimental::coroutine_handle<> producerCoroutine) noexcept
cppcoro::coroutine_handle<> producerCoroutine) noexcept
: m_promise(std::addressof(promise))
, m_producerCoroutine(producerCoroutine)
{
Expand Down Expand Up @@ -740,7 +740,7 @@ namespace cppcoro
return m_initialState == state::value_ready_producer_suspended;
}

bool await_suspend(std::experimental::coroutine_handle<> consumerCoroutine) noexcept
bool await_suspend(cppcoro::coroutine_handle<> consumerCoroutine) noexcept
{
m_promise->m_consumerCoroutine = consumerCoroutine;

Expand Down Expand Up @@ -791,7 +791,7 @@ namespace cppcoro
protected:

async_generator_promise_base* m_promise;
std::experimental::coroutine_handle<> m_producerCoroutine;
cppcoro::coroutine_handle<> m_producerCoroutine;

private:

Expand Down Expand Up @@ -872,7 +872,7 @@ namespace cppcoro
class async_generator_iterator final
{
using promise_type = async_generator_promise<T>;
using handle_type = std::experimental::coroutine_handle<promise_type>;
using handle_type = cppcoro::coroutine_handle<promise_type>;

public:

Expand Down Expand Up @@ -937,7 +937,7 @@ namespace cppcoro
class async_generator_begin_operation final : public async_generator_advance_operation
{
using promise_type = async_generator_promise<T>;
using handle_type = std::experimental::coroutine_handle<promise_type>;
using handle_type = cppcoro::coroutine_handle<promise_type>;

public:

Expand Down Expand Up @@ -988,7 +988,7 @@ namespace cppcoro
{}

explicit async_generator(promise_type& promise) noexcept
: m_coroutine(std::experimental::coroutine_handle<promise_type>::from_promise(promise))
: m_coroutine(cppcoro::coroutine_handle<promise_type>::from_promise(promise))
{}

async_generator(async_generator&& other) noexcept
Expand Down Expand Up @@ -1041,7 +1041,7 @@ namespace cppcoro

private:

std::experimental::coroutine_handle<promise_type> m_coroutine;
cppcoro::coroutine_handle<promise_type> m_coroutine;

};

Expand Down
Loading