1 // Copyright (C) 2023 The Android Open Source Project
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 //      http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #pragma once
16 
17 #if __ANDROID__
18 
19 #include <cstdint>
20 #include <random>
21 
22 #include <ditto/instruction.h>
23 
24 #include <ditto/binder.h>
25 
26 namespace dittosuite {
27 
28 class BinderService : public Instruction {
29  public:
30   inline static const std::string kName = "binder_service";
31 
32   explicit BinderService(const Params& params, const std::string& name, int64_t threads);
33 
34  protected:
35   int64_t threads_;
36 
37   void RunSingle() override;
38 
39  private:
40   std::string name_;
41   pthread_mutex_t  s_work_lock;
42   pthread_cond_t   s_work_cond;
43 
44   void SetUp() override;
45   void TearDown() override;
46 };
47 
48 }  // namespace dittosuite
49 
50 #endif
51