• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**
2  * Copyright (C) 2022 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 IIMS_MEDIA_THREAD
18 #define IIMS_MEDIA_THREAD
19 
20 #include <mutex>
21 
22 #define MAX_EVENTHANDLER_NAME 256
23 
24 /**
25  * @class IImsMediaThread
26  * @brief Base class of thread
27  *        - Child class should implement run() method.
28  *        - Call StartThread() method to start thread.
29  */
30 class IImsMediaThread
31 {
32 public:
33     IImsMediaThread();
34     virtual ~IImsMediaThread();
35     bool StartThread();
36     void SetAudioThreadPriority(pid_t tid);
37     void StopThread();
38     bool IsThreadStopped();
39     void* runBase();
40 
41 protected:
42     virtual void* run() = 0;
43 
44 protected:
45     std::mutex mThreadMutex;
46     bool mThreadStopped;
47 };
48 
49 #endif