浏览代码

fixed missing noexcepts for task_queue

channel
Ludovic 'Archivist' Lagouardette 3 年前
父节点
当前提交
e4d56697ae
共有 1 个文件被更改,包括 5 次插入6 次删除
  1. +5
    -6
      include/gp/system/task_queue.hpp

+ 5
- 6
include/gp/system/task_queue.hpp 查看文件

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

正在加载...
取消
保存