From 038eacfbf466f0b51e80b6f5fa9026c7ed767dfb Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Tue, 8 Oct 2019 12:47:16 +0200 Subject: darwin: speed up uv_set_process_title() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Libuv loaded and unloaded the Core Services and Application Services for every call to uv_set_process_title(). Change that to load them on the first call to uv_set_process_title() and delay unloading until libuv is unloaded. Speeds up process_title_threadsafe by about 10x on my system. It should fail less often (hopefully not at all) on the CI now. PR-URL: https://github.com/libuv/libuv/pull/2480 Reviewed-By: Saúl Ibarra Corretgé --- src/unix/proctitle.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/unix/proctitle.c') diff --git a/src/unix/proctitle.c b/src/unix/proctitle.c index 1a8c7a70..a5ce2030 100644 --- a/src/unix/proctitle.c +++ b/src/unix/proctitle.c @@ -24,6 +24,7 @@ #include #include +extern void uv__set_process_title_platform_init(void); extern void uv__set_process_title(const char* title); static uv_mutex_t process_title_mutex; @@ -38,6 +39,9 @@ static struct { static void init_process_title_mutex_once(void) { uv_mutex_init(&process_title_mutex); +#ifdef __APPLE__ + uv__set_process_title_platform_init(); +#endif } -- cgit v1.2.3