blob: 0072ac3d3eb2dc19d4333ffba1cad15b5ab7887e [file] [log] [blame]
Steven Moreland2e87adc2018-08-20 19:47:00 -07001/*
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>
Tomasz Wasilczyke3de8802023-11-01 11:05:27 -070018#include <binder/IPCThreadState.h>
Steven Moreland2e87adc2018-08-20 19:47:00 -070019
20#include <mutex>
21
Steven Moreland2e87adc2018-08-20 19:47:00 -070022using ::android::IPCThreadState;
23using ::android::ProcessState;
24
Nathan Egge7b4082b2023-03-10 20:44:39 +000025void ABinderProcess_startThreadPool(void) {
Steven Moreland2e87adc2018-08-20 19:47:00 -070026 ProcessState::self()->startThreadPool();
27 ProcessState::self()->giveThreadPoolName();
28}
29bool ABinderProcess_setThreadPoolMaxThreadCount(uint32_t numThreads) {
30 return ProcessState::self()->setThreadPoolMaxThreadCount(numThreads) == 0;
31}
Nathan Egge7b4082b2023-03-10 20:44:39 +000032bool ABinderProcess_isThreadPoolStarted(void) {
Devin Moore4354f712022-12-08 01:44:46 +000033 return ProcessState::self()->isThreadPoolStarted();
34}
Nathan Egge7b4082b2023-03-10 20:44:39 +000035void ABinderProcess_joinThreadPool(void) {
Steven Moreland2e87adc2018-08-20 19:47:00 -070036 IPCThreadState::self()->joinThreadPool();
37}
Steven Moreland23d058f2020-07-24 22:49:51 +000038
39binder_status_t ABinderProcess_setupPolling(int* fd) {
40 return IPCThreadState::self()->setupPolling(fd);
41}
42
Nathan Egge7b4082b2023-03-10 20:44:39 +000043binder_status_t ABinderProcess_handlePolledCommands(void) {
Steven Moreland23d058f2020-07-24 22:49:51 +000044 return IPCThreadState::self()->handlePolledCommands();
45}