Skip to content

Instantly share code, notes, and snippets.

@danielhenrymantilla
Last active October 25, 2023 10:34
Show Gist options
  • Save danielhenrymantilla/d5870819ccfd2d8c66146611e7d3a953 to your computer and use it in GitHub Desktop.
Save danielhenrymantilla/d5870819ccfd2d8c66146611e7d3a953 to your computer and use it in GitHub Desktop.
# http://www.graphviz.org/content/cluster
digraph G {
graph [fontname = "courier"];
node [fontname = "courier", shape=box];
edge [fontname = "courier"];
compound=true;
subgraph cluster_a {
style = dashed
label = "background (ffi) thread"
a [label = "call_js_cb(...args)"]
d [label = "ret_value"]
}
subgraph cluster_b {
style = dashed
label = "js thread"
b [
label = "js stuff\n "
style = invis
]
c [label = "enqueued_cb_call(ret_sender, ...args)"]
c2[label = "ret_sender(ret_value)"]
}
a -> b [
lhead = cluster_b
label = "\
enqueue call for next js tick\l\
with \l\
ret_sender = (x) => channel.send(x)\l\
being added to the args\l\
by safer-ffi.\l\
Scheduled call:\l
real_js_call(ret_sender, ...args)\n\
"
constraint = false
]
b -> c [
label = " eventually:\ntick()"
style = dotted
]
b -> d [style = invis]
c -> c2 [
label = " call completes"
]
c2 -> d [label = "channel.send(ret_value)"]
a -> d [
style = dotted
label = " wait for return value in channel"
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment