Main Page
Related Pages
Modules
Namespaces
Namespace List
Namespace Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
y
z
Enumerations
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
r
s
t
u
v
w
Enumerator
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
z
Classes
Class List
Class Hierarchy
Class Members
All
:
[
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
[
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
y
Enumerations
a
b
c
d
e
f
h
i
k
l
m
n
o
p
r
s
t
u
v
w
Enumerator
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
z
Properties
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
Related Functions
:
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
u
v
w
z
Files
File List
File Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Enumerations
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
u
v
w
x
Enumerator
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
x
Macros
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
grpc
third_party
libuv
docs
code
queue-work
libuv/docs/code/queue-work/main.c
Go to the documentation of this file.
1
#include <stdio.h>
2
#include <stdlib.h>
3
#include <unistd.h>
4
5
#include <
uv.h
>
6
7
#define FIB_UNTIL 25
8
uv_loop_t
*
loop
;
9
10
long
fib_
(
long
t) {
11
if
(t == 0 || t == 1)
12
return
1;
13
else
14
return
fib_
(t-1) +
fib_
(t-2);
15
}
16
17
void
fib
(
uv_work_t
*
req
) {
18
int
n
= *(
int
*)
req
->data;
19
if
(random() % 2)
20
sleep(1);
21
else
22
sleep(3);
23
long
fib
=
fib_
(
n
);
24
fprintf(
stderr
,
"%dth fibonacci is %lu\n"
,
n
,
fib
);
25
}
26
27
void
after_fib
(
uv_work_t
*
req
,
int
status
) {
28
fprintf(
stderr
,
"Done calculating %dth fibonacci\n"
, *(
int
*)
req
->data);
29
}
30
31
int
main
() {
32
loop
=
uv_default_loop
();
33
34
int
data
[
FIB_UNTIL
];
35
uv_work_t
req
[
FIB_UNTIL
];
36
int
i
;
37
for
(
i
= 0;
i
<
FIB_UNTIL
;
i
++) {
38
data
[
i
] =
i
;
39
req
[
i
].data = (
void
*) &
data
[
i
];
40
uv_queue_work
(
loop
, &
req
[
i
],
fib
,
after_fib
);
41
}
42
43
return
uv_run
(
loop
,
UV_RUN_DEFAULT
);
44
}
status
absl::Status status
Definition:
rls.cc:251
uv_run
UV_EXTERN int uv_run(uv_loop_t *, uv_run_mode mode)
Definition:
unix/core.c:361
uv_queue_work
UV_EXTERN int uv_queue_work(uv_loop_t *loop, uv_work_t *req, uv_work_cb work_cb, uv_after_work_cb after_work_cb)
Definition:
threadpool.c:338
FIB_UNTIL
#define FIB_UNTIL
Definition:
libuv/docs/code/queue-work/main.c:7
python_utils.port_server.stderr
stderr
Definition:
port_server.py:51
uv_default_loop
UV_EXTERN uv_loop_t * uv_default_loop(void)
Definition:
uv-common.c:733
req
static uv_connect_t req
Definition:
test-connection-fail.c:30
fib_
long fib_(long t)
Definition:
libuv/docs/code/queue-work/main.c:10
UV_RUN_DEFAULT
@ UV_RUN_DEFAULT
Definition:
uv.h:254
data
char data[kBufferLength]
Definition:
abseil-cpp/absl/strings/internal/str_format/float_conversion.cc:1006
main
int main()
Definition:
libuv/docs/code/queue-work/main.c:31
n
int n
Definition:
abseil-cpp/absl/container/btree_test.cc:1080
uv.h
fib
void fib(uv_work_t *req)
Definition:
libuv/docs/code/queue-work/main.c:17
loop
uv_loop_t * loop
Definition:
libuv/docs/code/queue-work/main.c:8
uv_loop_s
Definition:
uv.h:1767
after_fib
void after_fib(uv_work_t *req, int status)
Definition:
libuv/docs/code/queue-work/main.c:27
uv_work_s
Definition:
uv.h:1055
if
if(p->owned &&p->wrapped !=NULL)
Definition:
call.c:42
i
uint64_t i
Definition:
abseil-cpp/absl/container/btree_benchmark.cc:230
grpc
Author(s):
autogenerated on Thu Mar 13 2025 03:00:30