Steven Moreland | 2e87adc | 2018-08-20 19:47:00 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2018 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 | #include <android/binder_process.h> |
| 18 | |
| 19 | #include <mutex> |
| 20 | |
| 21 | #include <android-base/logging.h> |
| 22 | #include <binder/IPCThreadState.h> |
| 23 | |
| 24 | using ::android::IPCThreadState; |
| 25 | using ::android::ProcessState; |
| 26 | |
| 27 | void ABinderProcess_startThreadPool() { |
| 28 | ProcessState::self()->startThreadPool(); |
| 29 | ProcessState::self()->giveThreadPoolName(); |
| 30 | } |
| 31 | bool ABinderProcess_setThreadPoolMaxThreadCount(uint32_t numThreads) { |
| 32 | return ProcessState::self()->setThreadPoolMaxThreadCount(numThreads) == 0; |
| 33 | } |
| 34 | void ABinderProcess_joinThreadPool() { |
| 35 | IPCThreadState::self()->joinThreadPool(); |
| 36 | } |
Steven Moreland | 23d058f | 2020-07-24 22:49:51 +0000 | [diff] [blame] | 37 | |
| 38 | binder_status_t ABinderProcess_setupPolling(int* fd) { |
| 39 | return IPCThreadState::self()->setupPolling(fd); |
| 40 | } |
| 41 | |
| 42 | binder_status_t ABinderProcess_handlePolledCommands() { |
| 43 | return IPCThreadState::self()->handlePolledCommands(); |
| 44 | } |