Browse Source

fixed missing noexcepts for task_queue

channel
Ludovic 'Archivist' Lagouardette 3 years ago
parent
commit
e4d56697ae
1 changed files with 5 additions and 6 deletions
  1. +5
    -6
      include/gp/system/task_queue.hpp

+ 5
- 6
include/gp/system/task_queue.hpp View File

@ -5,7 +5,6 @@
#include <atomic> #include <atomic>
#include <new> #include <new>
// TODO: rename to task_queue and renamespace to gp::system (filename included)
// TODO: noexcept everything // TODO: noexcept everything
namespace gp { namespace gp {
@ -18,14 +17,14 @@ namespace gp {
alignas(gp_config::limits::hardware_constructive_interference_size) alignas(gp_config::limits::hardware_constructive_interference_size)
std::atomic<struct node*> next; std::atomic<struct node*> next;
node()
node() noexcept
{ {
is_locked = false; is_locked = false;
value = nullptr; value = nullptr;
next = nullptr; next = nullptr;
} }
node(node&& v)
node(node&& v) noexcept
{ {
v.try_acquire(); v.try_acquire();
is_locked = false; is_locked = false;
@ -46,7 +45,7 @@ namespace gp {
using node_ptr = struct node*; using node_ptr = struct node*;
using node_ptr_rep = std::atomic<struct node*>; using node_ptr_rep = std::atomic<struct node*>;
task_queue()
task_queue() noexcept
: start{nullptr} : start{nullptr}
, end{nullptr} , end{nullptr}
{} {}
@ -55,7 +54,7 @@ namespace gp {
node_ptr_rep end; node_ptr_rep end;
// NODES ARE ACQUIRED ON POP // NODES ARE ACQUIRED ON POP
node_ptr try_pop() {
node_ptr try_pop() k">noexcept {
auto ptr = start.load(); auto ptr = start.load();
if(!ptr) return nullptr; if(!ptr) return nullptr;
@ -78,7 +77,7 @@ namespace gp {
// ONLY PUSH ACQUIRED NODES, // ONLY PUSH ACQUIRED NODES,
// RELEASE WHEN NO LONGER IN USE // RELEASE WHEN NO LONGER IN USE
bool try_push(node_ptr node) {
bool try_push(node_ptr node) k">noexcept {
node->next.store(nullptr); node->next.store(nullptr);
auto ed = end.load(); auto ed = end.load();
if(ed) { if(ed) {

Loading…
Cancel
Save