Skip to content

Commit f037e8c

Browse files
authored
Version 0.1.0 (#39)
1 parent 0ef82b4 commit f037e8c

56 files changed

Lines changed: 6583 additions & 1910 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
cmake_minimum_required(VERSION 3.16)
22

33
project(concurrencpp
4-
VERSION 0.0.9
4+
VERSION 0.1.0
55
LANGUAGES CXX)
66

77
include(cmake/coroutineOptions.cmake)
@@ -25,6 +25,7 @@ set(concurrencpp_sources
2525
source/executors/worker_thread_executor.cpp
2626
source/results/impl/consumer_context.cpp
2727
source/results/impl/result_state.cpp
28+
source/results/impl/shared_result_state.cpp
2829
source/results/promises.cpp
2930
source/runtime/runtime.cpp
3031
source/threads/thread.cpp
@@ -50,11 +51,14 @@ set(concurrencpp_headers
5051
include/concurrencpp/results/impl/consumer_context.h
5152
include/concurrencpp/results/impl/producer_context.h
5253
include/concurrencpp/results/impl/result_state.h
54+
include/concurrencpp/results/impl/shared_result_state.h
5355
include/concurrencpp/results/constants.h
5456
include/concurrencpp/results/make_result.h
5557
include/concurrencpp/results/promises.h
5658
include/concurrencpp/results/result.h
59+
include/concurrencpp/results/shared_result.h
5760
include/concurrencpp/results/result_awaitable.h
61+
include/concurrencpp/results/shared_result_awaitable.h
5862
include/concurrencpp/results/result_fwd_declerations.h
5963
include/concurrencpp/results/when_result.h
6064
include/concurrencpp/runtime/constants.h

README.md

Lines changed: 1102 additions & 748 deletions
Large diffs are not rendered by default.

cmake/concurrencppInjectTSAN.cmake

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ macro(add_library TARGET)
44
_add_library(${ARGV})
55

66
if("${TARGET}" STREQUAL "concurrencpp")
7-
target_compile_options(concurrencpp PRIVATE -fsanitize=thread)
7+
target_compile_options(concurrencpp PUBLIC -fsanitize=thread)
8+
target_link_options(concurrencpp PUBLIC -fsanitize=thread)
89
endif()
910
endmacro()

include/concurrencpp/concurrencpp.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
#include "concurrencpp/results/result.h"
1111
#include "concurrencpp/results/make_result.h"
1212
#include "concurrencpp/results/when_result.h"
13+
#include "concurrencpp/results/shared_result.h"
14+
#include "concurrencpp/results/shared_result_awaitable.h"
1315
#include "concurrencpp/executors/executor_all.h"
1416

1517
#endif

include/concurrencpp/executors/executor.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
#include "concurrencpp/task.h"
55
#include "concurrencpp/results/result.h"
6+
#include "concurrencpp/results/promises.h"
67

78
#include <span>
89
#include <vector>

include/concurrencpp/executors/inline_executor.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,9 @@ namespace concurrencpp {
1111
std::atomic_bool m_abort;
1212

1313
void throw_if_aborted() const {
14-
if (!m_abort.load(std::memory_order_relaxed)) {
15-
return;
14+
if (m_abort.load(std::memory_order_relaxed)) {
15+
details::throw_executor_shutdown_exception(name);
1616
}
17-
18-
details::throw_executor_shutdown_exception(name);
1917
}
2018

2119
public:

include/concurrencpp/executors/manual_executor.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ namespace concurrencpp {
5050
size_t clear();
5151

5252
bool loop_once();
53-
5453
bool loop_once_for(std::chrono::milliseconds max_waiting_time);
5554

5655
template<class clock_type, class duration_type>
@@ -59,7 +58,6 @@ namespace concurrencpp {
5958
}
6059

6160
size_t loop(size_t max_count);
62-
6361
size_t loop_for(size_t max_count, std::chrono::milliseconds max_waiting_time);
6462

6563
template<class clock_type, class duration_type>
@@ -68,7 +66,6 @@ namespace concurrencpp {
6866
}
6967

7068
void wait_for_task();
71-
7269
bool wait_for_task_for(std::chrono::milliseconds max_waiting_time);
7370

7471
template<class clock_type, class duration_type>
@@ -77,7 +74,6 @@ namespace concurrencpp {
7774
}
7875

7976
void wait_for_tasks(size_t count);
80-
8177
size_t wait_for_tasks_for(size_t count, std::chrono::milliseconds max_waiting_time);
8278

8379
template<class clock_type, class duration_type>

include/concurrencpp/executors/thread_executor.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#ifndef CONCURRENCPP_THREAD_EXECUTOR_H
22
#define CONCURRENCPP_THREAD_EXECUTOR_H
33

4-
#include "concurrencpp/executors/derivable_executor.h"
54
#include "concurrencpp/threads/thread.h"
5+
#include "concurrencpp/executors/derivable_executor.h"
66

77
#include <list>
88
#include <span>

include/concurrencpp/platform_defs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#elif defined(unix) || defined(__unix__) || defined(__unix)
77
# define CRCPP_UNIX_OS
88
#elif defined(__APPLE__) || defined(__MACH__)
9-
# define CRCPP_MACH_OS
9+
# define CRCPP_MAC_OS
1010
#elif defined(__FreeBSD__)
1111
# define CRCPP_FREE_BSD_OS
1212
#elif defined(__ANDROID__)

include/concurrencpp/results/constants.h

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,28 @@ namespace concurrencpp::details::consts {
4848

4949
inline const char* k_broken_task_exception_error_msg = "concurrencpp::result - Associated task was interrupted abnormally";
5050

51+
inline const char* k_shared_result_status_error_msg = "shared_result::status() - result is empty.";
52+
53+
inline const char* k_shared_result_get_error_msg = "shared_result::get() - result is empty.";
54+
55+
inline const char* k_shared_result_wait_error_msg = "shared_result::wait() - result is empty.";
56+
57+
inline const char* k_shared_result_wait_for_error_msg = "shared_result::wait_for() - result is empty.";
58+
59+
inline const char* k_shared_result_wait_until_error_msg = "shared_result::wait_until() - result is empty.";
60+
61+
inline const char* k_shared_result_operator_co_await_error_msg = "shared_result::operator co_await() - result is empty.";
62+
63+
inline const char* k_shared_result_await_via_error_msg = "shared_result::await_via() - result is empty.";
64+
65+
inline const char* k_shared_result_await_via_executor_null_error_msg = "shared_result::await_via() - given executor is null.";
66+
67+
inline const char* k_shared_result_resolve_error_msg = "shared_result::resolve() - result is empty.";
68+
69+
inline const char* k_shared_result_resolve_via_error_msg = "shared_result::resolve_via() - result is empty.";
70+
71+
inline const char* k_shared_result_resolve_via_executor_null_error_msg = "shared_result::resolve_via() - given executor is null.";
72+
5173
} // namespace concurrencpp::details::consts
5274

5375
#endif

0 commit comments

Comments
 (0)