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 #include <binder/IPCThreadState.h> 19 20 #include <mutex> 21 22 using ::android::IPCThreadState; 23 using ::android::ProcessState; 24 ABinderProcess_startThreadPool(void)25void ABinderProcess_startThreadPool(void) { 26 ProcessState::self()->startThreadPool(); 27 ProcessState::self()->giveThreadPoolName(); 28 } ABinderProcess_setThreadPoolMaxThreadCount(uint32_t numThreads)29bool ABinderProcess_setThreadPoolMaxThreadCount(uint32_t numThreads) { 30 return ProcessState::self()->setThreadPoolMaxThreadCount(numThreads) == 0; 31 } ABinderProcess_isThreadPoolStarted(void)32bool ABinderProcess_isThreadPoolStarted(void) { 33 return ProcessState::self()->isThreadPoolStarted(); 34 } ABinderProcess_joinThreadPool(void)35void ABinderProcess_joinThreadPool(void) { 36 IPCThreadState::self()->joinThreadPool(); 37 } 38 ABinderProcess_setupPolling(int * fd)39binder_status_t ABinderProcess_setupPolling(int* fd) { 40 return IPCThreadState::self()->setupPolling(fd); 41 } 42 ABinderProcess_handlePolledCommands(void)43binder_status_t ABinderProcess_handlePolledCommands(void) { 44 return IPCThreadState::self()->handlePolledCommands(); 45 } 46