MCPcopy Create free account
hub / github.com/emscripten-core/emscripten / recv

Method recv

system/lib/llvm-libc/shared/rpc.h:403–421  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

401
402/// Applies \p use to the shared buffer and acknowledges the send.
403template <bool T> template <typename U> RPC_ATTRS void Port<T>::recv(U use) {
404 // We only exchange ownership of the buffer during a receive if we are waiting
405 // for a previous receive to finish.
406 if (receive) {
407 out = process.invert_outbox(index, out);
408 owns_buffer = false;
409 }
410
411 uint32_t in = owns_buffer ? out ^ T : process.load_inbox(lane_mask, index);
412
413 // We need to wait until we own the buffer before receiving.
414 process.wait_for_ownership(lane_mask, index, out, in);
415
416 // Apply the \p use function to read the memory out of the buffer.
417 invoke_rpc(use, lane_size, process.header[index].mask,
418 process.get_packet(index, lane_size));
419 receive = true;
420 owns_buffer = true;
421}
422
423/// Combines a send and receive into a single function.
424template <bool T>

Callers 7

handleMethod · 0.80
runMethod · 0.80
listenFunction · 0.80
write_to_stderrFunction · 0.80
handle_printfFunction · 0.80
LLVM_LIBC_FUNCTIONFunction · 0.80

Calls 5

invoke_rpcFunction · 0.85
invert_outboxMethod · 0.80
load_inboxMethod · 0.80
wait_for_ownershipMethod · 0.80
get_packetMethod · 0.80

Tested by 1

handleMethod · 0.64