mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-12-22 07:57:39 +00:00
parent
b44141ae39
commit
f2c4288d2d
@ -433,6 +433,7 @@ static void daemon_entry() {
|
||||
register_poll(&main_socket_pfd, handle_request);
|
||||
|
||||
// Loop forever to listen for requests
|
||||
init_thread_pool();
|
||||
poll_loop();
|
||||
}
|
||||
|
||||
|
@ -52,6 +52,7 @@ void unregister_poll(int fd, bool auto_close);
|
||||
void clear_poll();
|
||||
|
||||
// Thread pool
|
||||
void init_thread_pool();
|
||||
void exec_task(std::function<void()> &&task);
|
||||
|
||||
// Daemon handlers
|
||||
|
@ -42,8 +42,6 @@ static void reset_pool() {
|
||||
}
|
||||
|
||||
static void *thread_pool_loop(void * const is_core_pool) {
|
||||
pthread_atfork(nullptr, nullptr, &reset_pool);
|
||||
|
||||
// Block all signals
|
||||
sigset_t mask;
|
||||
sigfillset(&mask);
|
||||
@ -83,6 +81,10 @@ static void *thread_pool_loop(void * const is_core_pool) {
|
||||
}
|
||||
}
|
||||
|
||||
void init_thread_pool() {
|
||||
pthread_atfork(nullptr, nullptr, &reset_pool);
|
||||
}
|
||||
|
||||
void exec_task(function<void()> &&task) {
|
||||
mutex_guard g(lock);
|
||||
pending_task.swap(task);
|
||||
|
@ -15,6 +15,8 @@ static void zygiskd(int socket) {
|
||||
if (getuid() != 0 || fcntl(socket, F_GETFD) < 0)
|
||||
exit(-1);
|
||||
|
||||
init_thread_pool();
|
||||
|
||||
#if defined(__LP64__)
|
||||
set_nice_name("zygiskd64");
|
||||
LOGI("* Launching zygiskd64\n");
|
||||
|
Loading…
x
Reference in New Issue
Block a user