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