blob: 011921dc5f752938c3dbf4b711b295a382d0946e [file] [log] [blame]
Glenn Kastena18f6442014-03-18 17:17:04 -07001/*
2 * Copyright (C) 2014 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef ANDROID_AUDIO_FAST_THREAD_STATE_H
18#define ANDROID_AUDIO_FAST_THREAD_STATE_H
19
Glenn Kasten22340022014-04-07 12:04:41 -070020#include "Configuration.h"
Glenn Kastena18f6442014-03-18 17:17:04 -070021#include <stdint.h>
22#include <media/nbaio/NBLog.h>
23
24namespace android {
25
Glenn Kasten22340022014-04-07 12:04:41 -070026struct FastThreadDumpState;
27
Glenn Kastena18f6442014-03-18 17:17:04 -070028// Represents a single state of a FastThread
29struct FastThreadState {
30 FastThreadState();
31 /*virtual*/ ~FastThreadState();
32
33 typedef uint32_t Command;
34 static const Command
35 INITIAL = 0, // used only for the initial state
36 HOT_IDLE = 1, // do nothing
37 COLD_IDLE = 2, // wait for the futex
38 IDLE = 3, // either HOT_IDLE or COLD_IDLE
39 EXIT = 4; // exit from thread
40 // additional values defined per subclass
Glenn Kasten22340022014-04-07 12:04:41 -070041 Command mCommand; // current command
Glenn Kastena18f6442014-03-18 17:17:04 -070042 int32_t* mColdFutexAddr; // for COLD_IDLE only, pointer to the associated futex
43 unsigned mColdGen; // increment when COLD_IDLE is requested so it's only performed once
44
Glenn Kasten22340022014-04-07 12:04:41 -070045 // This might be a one-time configuration rather than per-state
46 FastThreadDumpState* mDumpState; // if non-NULL, then update dump state periodically
Glenn Kastena18f6442014-03-18 17:17:04 -070047 NBLog::Writer* mNBLogWriter; // non-blocking logger
Glenn Kasten22340022014-04-07 12:04:41 -070048
Glenn Kastena18f6442014-03-18 17:17:04 -070049}; // struct FastThreadState
50
Glenn Kastena18f6442014-03-18 17:17:04 -070051} // android
52
53#endif // ANDROID_AUDIO_FAST_THREAD_STATE_H