ardour
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
libs
ardour
ardour
worker.h
Go to the documentation of this file.
1
/*
2
Copyright (C) 2012 Paul Davis
3
Author: David Robillard
4
5
This program is free software; you can redistribute it and/or modify
6
it under the terms of the GNU General Public License as published by
7
the Free Software Foundation; either version 2 of the License, or
8
(at your option) any later version.
9
10
This program is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
GNU General Public License for more details.
14
15
You should have received a copy of the GNU General Public License
16
along with this program; if not, write to the Free Software
17
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18
*/
19
20
#ifndef __ardour_worker_h__
21
#define __ardour_worker_h__
22
23
#include <stdint.h>
24
25
#include <glibmm/threads.h>
26
27
#include "
pbd/ringbuffer.h
"
28
#include "
pbd/semaphore.h
"
29
30
#include "
ardour/libardour_visibility.h
"
31
32
namespace
ARDOUR
{
33
37
class
LIBARDOUR_API
Workee
{
38
public
:
39
virtual
~Workee
() {}
40
44
virtual
int
work(uint32_t size,
const
void
* data) = 0;
45
49
virtual
int
work_response(uint32_t size,
const
void
* data) = 0;
50
};
51
55
class
LIBARDOUR_API
Worker
56
{
57
public
:
58
Worker
(
Workee
* workee, uint32_t ring_size);
59
~
Worker
();
60
65
bool
schedule(uint32_t size,
const
void
* data);
66
71
bool
respond(uint32_t size,
const
void
* data);
72
76
void
emit_responses();
77
78
private
:
79
void
run();
89
bool
verify_message_completeness(
RingBuffer<uint8_t>
* rb);
90
91
Workee
*
_workee
;
92
RingBuffer<uint8_t>
*
_requests
;
93
RingBuffer<uint8_t>
*
_responses
;
94
uint8_t*
_response
;
95
PBD::Semaphore
_sem
;
96
bool
_exit
;
97
Glib::Threads::Thread*
_thread
;
98
99
};
100
101
}
// namespace ARDOUR
102
103
#endif
/* __ardour_worker_h__ */
ringbuffer.h
ARDOUR::Worker
Definition:
worker.h:55
ARDOUR::Worker::_workee
Workee * _workee
Definition:
worker.h:91
ARDOUR::Workee
Definition:
worker.h:37
PBD::Semaphore
Definition:
semaphore.h:52
ARDOUR::Workee::~Workee
virtual ~Workee()
Definition:
worker.h:39
ARDOUR::Worker::_responses
RingBuffer< uint8_t > * _responses
Definition:
worker.h:93
ARDOUR
Definition:
amp.h:29
ARDOUR::Worker::_requests
RingBuffer< uint8_t > * _requests
Definition:
worker.h:92
ARDOUR::Worker::_thread
Glib::Threads::Thread * _thread
Definition:
worker.h:97
libardour_visibility.h
ARDOUR::Worker::_exit
bool _exit
Definition:
worker.h:96
LIBARDOUR_API
#define LIBARDOUR_API
Definition:
libardour_visibility.h:40
ARDOUR::Worker::_response
uint8_t * _response
Definition:
worker.h:94
semaphore.h
ARDOUR::Worker::_sem
PBD::Semaphore _sem
Definition:
worker.h:95
RingBuffer< uint8_t >
Generated on Sun May 24 2015 12:15:05 for ardour by
1.8.8