TPIE
11a2c2d
job.h
Go to the documentation of this file.
1
// -*- mode: c++; tab-width: 4; indent-tabs-mode: t; c-file-style: "stroustrup"; -*-
2
// vi:set ts=4 sts=4 sw=4 noet cino+=(0 :
3
// Copyright 2011, The TPIE development team
4
//
5
// This file is part of TPIE.
6
//
7
// TPIE is free software: you can redistribute it and/or modify it under
8
// the terms of the GNU Lesser General Public License as published by the
9
// Free Software Foundation, either version 3 of the License, or (at your
10
// option) any later version.
11
//
12
// TPIE is distributed in the hope that it will be useful, but WITHOUT ANY
13
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
14
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
15
// License for more details.
16
//
17
// You should have received a copy of the GNU Lesser General Public License
18
// along with TPIE. If not, see <http://www.gnu.org/licenses/>
19
20
#ifndef __TPIE_JOB_MANAGER_H__
21
#define __TPIE_JOB_MANAGER_H__
22
26
27
#include <tpie/tpie_export.h>
28
#include <stddef.h>
29
#include <condition_variable>
30
#include <
tpie/types.h
>
31
32
namespace
tpie
{
33
34
class
TPIE_EXPORT
job
{
35
36
enum
job_state { job_idle, job_enqueued, job_running };
37
38
public
:
39
43
job
();
44
48
virtual
~job
() {}
49
53
virtual
void
operator()() = 0;
54
58
void
join();
59
63
bool
is_done();
64
70
void
enqueue(
job
* parent = 0);
71
77
void
run();
78
79
protected
:
80
84
virtual
void
on_done
() {}
85
86
private
:
87
88
size_t
m_dependencies;
89
job
* m_parent;
90
job_state m_state;
91
95
std::condition_variable m_done;
96
103
void
done();
104
108
friend
class
job_manager;
109
};
110
121
TPIE_EXPORT memory_size_type
default_worker_count
();
122
126
void
init_job
();
127
131
void
finish_job
();
132
133
}
// namespace tpie
134
135
#endif
types.h
tpie::job
Definition:
job.h:34
tpie::job::on_done
virtual void on_done()
Called when this job and all subjobs are done.
Definition:
job.h:84
tpie::init_job
void init_job()
Used by tpie_init to initialize the job subsystem.
tpie::finish_job
void finish_job()
Used by tpie_finish to deinitialize the job subsystem.
tpie::default_worker_count
TPIE_EXPORT memory_size_type default_worker_count()
Return the number of job threads initialized by the job framework in init_job().
tpie
Definition:
access_type.h:26
tpie::job::~job
virtual ~job()
Default destructor.
Definition:
job.h:48
from TPIE 11a2c2d (
browse source
). Generated on Tue Jun 8 2021 12:44:17 by
Doxygen
1.8.17