grpc
third_party
libuv
docs
code
detach
libuv/docs/code/detach/main.c
Go to the documentation of this file.
1
#include <stdio.h>
2
3
#include <
uv.h
>
4
5
uv_loop_t
*
loop
;
6
uv_process_t
child_req
;
7
uv_process_options_t
options
;
8
9
int
main
() {
10
loop
=
uv_default_loop
();
11
12
char
*
args
[3];
13
args
[0] =
"sleep"
;
14
args
[1] =
"100"
;
15
args
[2] = NULL;
16
17
options
.
exit_cb
= NULL;
18
options
.
file
=
"sleep"
;
19
options
.
args
=
args
;
20
options
.
flags
=
UV_PROCESS_DETACHED
;
21
22
int
r
;
23
if
((
r
=
uv_spawn
(
loop
, &
child_req
, &
options
))) {
24
fprintf(
stderr
,
"%s\n"
,
uv_strerror
(
r
));
25
return
1;
26
}
27
fprintf(
stderr
,
"Launched sleep with PID %d\n"
,
child_req
.
pid
);
28
uv_unref
((
uv_handle_t
*) &
child_req
);
29
30
return
uv_run
(
loop
,
UV_RUN_DEFAULT
);
31
}
uv_process_options_s
Definition:
uv.h:940
uv_process_s
Definition:
uv.h:1037
uv_process_options_s::exit_cb
uv_exit_cb exit_cb
Definition:
uv.h:941
main
int main()
Definition:
libuv/docs/code/detach/main.c:9
uv_strerror
const UV_EXTERN char * uv_strerror(int err)
Definition:
uv-common.c:212
uv_run
UV_EXTERN int uv_run(uv_loop_t *, uv_run_mode mode)
Definition:
unix/core.c:361
uv_unref
UV_EXTERN void uv_unref(uv_handle_t *)
Definition:
uv-common.c:522
python_utils.port_server.stderr
stderr
Definition:
port_server.py:51
uv_process_options_s::file
const char * file
Definition:
uv.h:942
uv_default_loop
UV_EXTERN uv_loop_t * uv_default_loop(void)
Definition:
uv-common.c:733
asyncio_get_stats.args
args
Definition:
asyncio_get_stats.py:40
uv_process_options_s::args
char ** args
Definition:
uv.h:949
child_req
uv_process_t child_req
Definition:
libuv/docs/code/detach/main.c:6
UV_RUN_DEFAULT
@ UV_RUN_DEFAULT
Definition:
uv.h:254
uv_process_options_s::flags
unsigned int flags
Definition:
uv.h:964
uv_process_s::pid
int pid
Definition:
uv.h:1040
uv_spawn
UV_EXTERN int uv_spawn(uv_loop_t *loop, uv_process_t *handle, const uv_process_options_t *options)
Definition:
unix/process.c:408
uv.h
options
uv_process_options_t options
Definition:
libuv/docs/code/detach/main.c:7
fix_build_deps.r
r
Definition:
fix_build_deps.py:491
UV_PROCESS_DETACHED
@ UV_PROCESS_DETACHED
Definition:
uv.h:1014
uv_handle_s
Definition:
uv.h:441
uv_loop_s
Definition:
uv.h:1767
loop
uv_loop_t * loop
Definition:
libuv/docs/code/detach/main.c:5
grpc
Author(s):
autogenerated on Fri May 16 2025 02:59:17