Sha256: 796b53ff33afbd2cefd9ca0fd23916a368a630291ae6e0b3bfe071dbc642e234

Contents?: true

Size: 1.11 KB

Versions: 10

Compression:

Stored size: 1.11 KB

Contents

// Copyright 2015 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef V8_LOCKED_QUEUE_
#define V8_LOCKED_QUEUE_

#include "src/allocation.h"
#include "src/base/platform/platform.h"

namespace v8 {
namespace internal {

// Simple lock-based unbounded size queue (multi producer; multi consumer) based
// on "Simple, Fast, and Practical Non-Blocking and Blocking Concurrent Queue
// Algorithms" by M. Scott and M. Michael.
// See:
// https://www.cs.rochester.edu/research/synchronization/pseudocode/queues.html
template <typename Record>
class LockedQueue final BASE_EMBEDDED {
 public:
  inline LockedQueue();
  inline ~LockedQueue();
  inline void Enqueue(const Record& record);
  inline bool Dequeue(Record* record);
  inline bool IsEmpty() const;
  inline bool Peek(Record* record) const;

 private:
  struct Node;

  mutable base::Mutex head_mutex_;
  base::Mutex tail_mutex_;
  Node* head_;
  Node* tail_;

  DISALLOW_COPY_AND_ASSIGN(LockedQueue);
};

}  // namespace internal
}  // namespace v8

#endif  // V8_LOCKED_QUEUE_

Version data entries

10 entries across 9 versions & 2 rubygems

Version Path
libv8-6.0.286.54.1 vendor/v8/src/locked-queue.h
libv8-6.0.286.54.0 vendor/v8/src/locked-queue.h
libv8-6.0.286.54.0beta2 vendor/v8/src/locked-queue.h
libv8-6.0.286.54.0beta1 vendor/v8/src/locked-queue.h
libv8-6.0.286.44.0beta1 vendor/v8/src/locked-queue.h
node-compiler-0.9.1 vendor/node/deps/v8/src/locked-queue.h
node-compiler-0.9.0 vendor/node-v7.2.1/deps/v8/src/locked-queue.h
node-compiler-0.8.0 vendor/node-v7.2.0/deps/v8/src/locked-queue.h
node-compiler-0.7.0 vendor/node-v7.1.0/deps/v8/src/locked-queue.h
node-compiler-0.7.0 vendor/node-v6.9.1/deps/v8/src/locked-queue.h