V8 Project
task-queue.h
Go to the documentation of this file.
1
// Copyright 2013 the V8 project authors. All rights reserved.
2
// Use of this source code is governed by a BSD-style license that can be
3
// found in the LICENSE file.
4
5
#ifndef V8_LIBPLATFORM_TASK_QUEUE_H_
6
#define V8_LIBPLATFORM_TASK_QUEUE_H_
7
8
#include <queue>
9
10
#include "
src/base/macros.h
"
11
#include "
src/base/platform/mutex.h
"
12
#include "
src/base/platform/semaphore.h
"
13
14
namespace
v8
{
15
16
class
Task;
17
18
namespace
platform {
19
20
class
TaskQueue
{
21
public
:
22
TaskQueue
();
23
~TaskQueue
();
24
25
// Appends a task to the queue. The queue takes ownership of |task|.
26
void
Append
(
Task
* task);
27
28
// Returns the next task to process. Blocks if no task is available. Returns
29
// NULL if the queue is terminated.
30
Task
*
GetNext
();
31
32
// Terminate the queue.
33
void
Terminate
();
34
35
private
:
36
base::Mutex
lock_
;
37
base::Semaphore
process_queue_semaphore_
;
38
std::queue<Task*>
task_queue_
;
39
bool
terminated_
;
40
41
DISALLOW_COPY_AND_ASSIGN
(
TaskQueue
);
42
};
43
44
} }
// namespace v8::platform
45
46
47
#endif
// V8_LIBPLATFORM_TASK_QUEUE_H_
v8::Task
A Task represents a unit of work.
Definition:
v8-platform.h:15
v8::platform::TaskQueue
Definition:
task-queue.h:20
v8::platform::TaskQueue::task_queue_
std::queue< Task * > task_queue_
Definition:
task-queue.h:38
v8::platform::TaskQueue::Append
void Append(Task *task)
Definition:
task-queue.cc:22
v8::platform::TaskQueue::terminated_
bool terminated_
Definition:
task-queue.h:39
v8::platform::TaskQueue::TaskQueue
TaskQueue()
Definition:
task-queue.cc:12
v8::platform::TaskQueue::~TaskQueue
~TaskQueue()
Definition:
task-queue.cc:15
v8::platform::TaskQueue::Terminate
void Terminate()
Definition:
task-queue.cc:49
v8::platform::TaskQueue::lock_
base::Mutex lock_
Definition:
task-queue.h:36
v8::platform::TaskQueue::process_queue_semaphore_
base::Semaphore process_queue_semaphore_
Definition:
task-queue.h:37
v8::platform::TaskQueue::DISALLOW_COPY_AND_ASSIGN
DISALLOW_COPY_AND_ASSIGN(TaskQueue)
v8::platform::TaskQueue::GetNext
Task * GetNext()
Definition:
task-queue.cc:30
macros.h
mutex.h
v8
Debugger support for the V8 JavaScript engine.
Definition:
accessors.cc:20
semaphore.h
mnt
V8SourceCode
src
libplatform
task-queue.h
Generated on Tue Jul 1 2025 02:36:41 for V8 Project by
1.9.1