mailbox.h

Include dependency graph for mailbox.h:

digraph {
    graph [bgcolor="#00000000"]
    node [shape=rectangle style=filled fillcolor="#FFFFFF" font=Helvetica padding=2]
    edge [color="#1414CE"]
    "2" [label="stdbool.h" tooltip="stdbool.h"]
    "5" [label="assert.h" tooltip="assert.h"]
    "8" [label="stdint.h" tooltip="stdint.h"]
    "12" [label="stdlib.h" tooltip="stdlib.h"]
    "9" [label="utils.h" tooltip="utils.h"]
    "4" [label="term_typedef.h" tooltip="term_typedef.h"]
    "10" [label="stddef.h" tooltip="stddef.h"]
    "6" [label="limits.h" tooltip="limits.h"]
    "1" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/mailbox.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/mailbox.h" fillcolor="#BFBFBF"]
    "11" [label="stdio.h" tooltip="stdio.h"]
    "7" [label="inttypes.h" tooltip="inttypes.h"]
    "3" [label="list.h" tooltip="list.h"]
    "9" -> "10" [dir=forward tooltip="include"]
    "9" -> "11" [dir=forward tooltip="include"]
    "9" -> "12" [dir=forward tooltip="include"]
    "4" -> "5" [dir=forward tooltip="include"]
    "4" -> "6" [dir=forward tooltip="include"]
    "4" -> "7" [dir=forward tooltip="include"]
    "4" -> "8" [dir=forward tooltip="include"]
    "1" -> "2" [dir=forward tooltip="include"]
    "1" -> "3" [dir=forward tooltip="include"]
    "1" -> "4" [dir=forward tooltip="include"]
    "1" -> "9" [dir=forward tooltip="include"]
}

This graph shows which files directly or indirectly include mailbox.h:

digraph {
    graph [bgcolor="#00000000"]
    node [shape=rectangle style=filled fillcolor="#FFFFFF" font=Helvetica padding=2]
    edge [color="#1414CE"]
    "5" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/bif.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/bif.c"]
    "46" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/dictionary.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/dictionary.c"]
    "4" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/bif.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/bif.h"]
    "28" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/platform_nifs.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/platform_nifs.h"]
    "16" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/posix_nifs.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/posix_nifs.c"]
    "47" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/posix_nifs.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/posix_nifs.h"]
    "45" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/defaultatoms.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/defaultatoms.c"]
    "44" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/defaultatoms.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/defaultatoms.h"]
    "22" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/inet.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/inet.c"]
    "21" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/inet.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/inet.h"]
    "11" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/scheduler.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/scheduler.c"]
    "39" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/scheduler.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/scheduler.h"]
    "2" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/context.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/context.c"]
    "3" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/context.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/context.h"]
    "37" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/port.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/port.c"]
    "38" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/port.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/port.h"]
    "30" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/stacktrace.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/stacktrace.c"]
    "29" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/stacktrace.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/stacktrace.h"]
    "17" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/refc_binary.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/refc_binary.c"]
    "40" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/mailbox.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/mailbox.c"]
    "1" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/mailbox.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/mailbox.h" fillcolor="#BFBFBF"]
    "6" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/module.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/module.c"]
    "27" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/module.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/module.h"]
    "43" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/avmpack.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/avmpack.c"]
    "42" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/avmpack.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/avmpack.h"]
    "26" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/term.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/term.c"]
    "24" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/interop.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/interop.c"]
    "15" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/otp_ssl.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/otp_ssl.c"]
    "20" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/interop.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/interop.h"]
    "36" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/otp_ssl.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/otp_ssl.h"]
    "18" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/resources.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/resources.c"]
    "25" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/otp_crypto.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/otp_crypto.c"]
    "33" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/otp_crypto.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/otp_crypto.h"]
    "23" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/otp_net.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/otp_net.c"]
    "34" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/otp_net.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/otp_net.h"]
    "12" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/erl_nif_priv.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/erl_nif_priv.h"]
    "31" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/sys.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/sys.h"]
    "7" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/nifs.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/nifs.c"]
    "32" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/nifs.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/nifs.h"]
    "9" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/debug.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/debug.c"]
    "8" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/debug.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/debug.h"]
    "13" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/globalcontext.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/globalcontext.c"]
    "41" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/globalcontext.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/globalcontext.h"]
    "10" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/memory.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/memory.c"]
    "14" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/otp_socket.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/otp_socket.c"]
    "35" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/otp_socket.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/otp_socket.h"]
    "19" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/externalterm.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/externalterm.c"]
    "4" -> "5" [dir=back tooltip="include"]
    "4" -> "6" [dir=back tooltip="include"]
    "4" -> "7" [dir=back tooltip="include"]
    "28" -> "7" [dir=back tooltip="include"]
    "47" -> "13" [dir=back tooltip="include"]
    "47" -> "7" [dir=back tooltip="include"]
    "47" -> "14" [dir=back tooltip="include"]
    "47" -> "16" [dir=back tooltip="include"]
    "44" -> "5" [dir=back tooltip="include"]
    "44" -> "45" [dir=back tooltip="include"]
    "44" -> "46" [dir=back tooltip="include"]
    "44" -> "13" [dir=back tooltip="include"]
    "44" -> "24" [dir=back tooltip="include"]
    "44" -> "7" [dir=back tooltip="include"]
    "44" -> "25" [dir=back tooltip="include"]
    "44" -> "23" [dir=back tooltip="include"]
    "44" -> "14" [dir=back tooltip="include"]
    "44" -> "15" [dir=back tooltip="include"]
    "44" -> "37" [dir=back tooltip="include"]
    "44" -> "38" [dir=back tooltip="include"]
    "44" -> "16" [dir=back tooltip="include"]
    "44" -> "18" [dir=back tooltip="include"]
    "44" -> "30" [dir=back tooltip="include"]
    "21" -> "22" [dir=back tooltip="include"]
    "21" -> "23" [dir=back tooltip="include"]
    "21" -> "14" [dir=back tooltip="include"]
    "21" -> "15" [dir=back tooltip="include"]
    "39" -> "13" [dir=back tooltip="include"]
    "39" -> "40" [dir=back tooltip="include"]
    "39" -> "7" [dir=back tooltip="include"]
    "39" -> "14" [dir=back tooltip="include"]
    "39" -> "11" [dir=back tooltip="include"]
    "3" -> "4" [dir=back tooltip="include"]
    "3" -> "2" [dir=back tooltip="include"]
    "3" -> "8" [dir=back tooltip="include"]
    "3" -> "12" [dir=back tooltip="include"]
    "3" -> "19" [dir=back tooltip="include"]
    "3" -> "13" [dir=back tooltip="include"]
    "3" -> "20" [dir=back tooltip="include"]
    "3" -> "10" [dir=back tooltip="include"]
    "3" -> "6" [dir=back tooltip="include"]
    "3" -> "27" [dir=back tooltip="include"]
    "3" -> "7" [dir=back tooltip="include"]
    "3" -> "32" [dir=back tooltip="include"]
    "3" -> "25" [dir=back tooltip="include"]
    "3" -> "23" [dir=back tooltip="include"]
    "3" -> "14" [dir=back tooltip="include"]
    "3" -> "15" [dir=back tooltip="include"]
    "3" -> "37" [dir=back tooltip="include"]
    "3" -> "38" [dir=back tooltip="include"]
    "3" -> "17" [dir=back tooltip="include"]
    "3" -> "18" [dir=back tooltip="include"]
    "3" -> "39" [dir=back tooltip="include"]
    "3" -> "29" [dir=back tooltip="include"]
    "3" -> "26" [dir=back tooltip="include"]
    "38" -> "22" [dir=back tooltip="include"]
    "38" -> "7" [dir=back tooltip="include"]
    "38" -> "23" [dir=back tooltip="include"]
    "38" -> "14" [dir=back tooltip="include"]
    "38" -> "15" [dir=back tooltip="include"]
    "38" -> "37" [dir=back tooltip="include"]
    "29" -> "30" [dir=back tooltip="include"]
    "1" -> "2" [dir=back tooltip="include"]
    "1" -> "3" [dir=back tooltip="include"]
    "1" -> "13" [dir=back tooltip="include"]
    "1" -> "41" [dir=back tooltip="include"]
    "1" -> "40" [dir=back tooltip="include"]
    "1" -> "7" [dir=back tooltip="include"]
    "1" -> "14" [dir=back tooltip="include"]
    "1" -> "37" [dir=back tooltip="include"]
    "27" -> "4" [dir=back tooltip="include"]
    "27" -> "6" [dir=back tooltip="include"]
    "27" -> "7" [dir=back tooltip="include"]
    "27" -> "28" [dir=back tooltip="include"]
    "27" -> "29" [dir=back tooltip="include"]
    "27" -> "31" [dir=back tooltip="include"]
    "27" -> "26" [dir=back tooltip="include"]
    "42" -> "43" [dir=back tooltip="include"]
    "42" -> "13" [dir=back tooltip="include"]
    "42" -> "7" [dir=back tooltip="include"]
    "20" -> "21" [dir=back tooltip="include"]
    "20" -> "24" [dir=back tooltip="include"]
    "20" -> "7" [dir=back tooltip="include"]
    "20" -> "25" [dir=back tooltip="include"]
    "20" -> "23" [dir=back tooltip="include"]
    "20" -> "14" [dir=back tooltip="include"]
    "20" -> "15" [dir=back tooltip="include"]
    "20" -> "16" [dir=back tooltip="include"]
    "20" -> "26" [dir=back tooltip="include"]
    "36" -> "15" [dir=back tooltip="include"]
    "33" -> "25" [dir=back tooltip="include"]
    "34" -> "23" [dir=back tooltip="include"]
    "12" -> "2" [dir=back tooltip="include"]
    "12" -> "13" [dir=back tooltip="include"]
    "12" -> "10" [dir=back tooltip="include"]
    "12" -> "14" [dir=back tooltip="include"]
    "12" -> "15" [dir=back tooltip="include"]
    "12" -> "16" [dir=back tooltip="include"]
    "12" -> "17" [dir=back tooltip="include"]
    "12" -> "18" [dir=back tooltip="include"]
    "31" -> "2" [dir=back tooltip="include"]
    "31" -> "13" [dir=back tooltip="include"]
    "31" -> "6" [dir=back tooltip="include"]
    "31" -> "7" [dir=back tooltip="include"]
    "31" -> "14" [dir=back tooltip="include"]
    "31" -> "18" [dir=back tooltip="include"]
    "31" -> "11" [dir=back tooltip="include"]
    "32" -> "6" [dir=back tooltip="include"]
    "32" -> "7" [dir=back tooltip="include"]
    "32" -> "25" [dir=back tooltip="include"]
    "32" -> "33" [dir=back tooltip="include"]
    "32" -> "23" [dir=back tooltip="include"]
    "32" -> "34" [dir=back tooltip="include"]
    "32" -> "14" [dir=back tooltip="include"]
    "32" -> "35" [dir=back tooltip="include"]
    "32" -> "15" [dir=back tooltip="include"]
    "32" -> "36" [dir=back tooltip="include"]
    "32" -> "16" [dir=back tooltip="include"]
    "8" -> "9" [dir=back tooltip="include"]
    "8" -> "10" [dir=back tooltip="include"]
    "8" -> "11" [dir=back tooltip="include"]
    "41" -> "42" [dir=back tooltip="include"]
    "41" -> "2" [dir=back tooltip="include"]
    "41" -> "3" [dir=back tooltip="include"]
    "41" -> "44" [dir=back tooltip="include"]
    "41" -> "13" [dir=back tooltip="include"]
    "41" -> "10" [dir=back tooltip="include"]
    "41" -> "6" [dir=back tooltip="include"]
    "41" -> "27" [dir=back tooltip="include"]
    "41" -> "7" [dir=back tooltip="include"]
    "41" -> "25" [dir=back tooltip="include"]
    "41" -> "23" [dir=back tooltip="include"]
    "41" -> "34" [dir=back tooltip="include"]
    "41" -> "14" [dir=back tooltip="include"]
    "41" -> "35" [dir=back tooltip="include"]
    "41" -> "15" [dir=back tooltip="include"]
    "41" -> "36" [dir=back tooltip="include"]
    "41" -> "37" [dir=back tooltip="include"]
    "41" -> "38" [dir=back tooltip="include"]
    "41" -> "16" [dir=back tooltip="include"]
    "41" -> "47" [dir=back tooltip="include"]
    "41" -> "39" [dir=back tooltip="include"]
    "41" -> "30" [dir=back tooltip="include"]
    "41" -> "31" [dir=back tooltip="include"]
    "35" -> "14" [dir=back tooltip="include"]
    "35" -> "15" [dir=back tooltip="include"]
}

Mailbox management functions such as send and receive functions.

Mailbox management functions should be used to send messages to a certain process or port and to receive them.

Defines

ATOMIC
TYPEDEF_CONTEXT
TYPEDEF_HEAP
TYPEDEF_MAILBOXMESSAGE

Typedefs

typedef struct Context Context
typedef struct Heap Heap
typedef struct MailboxMessage MailboxMessage
typedef struct Message Message

Enums

enum MessageType

Values:

enumerator NormalMessage
enumerator KillSignal
enumerator GCSignal
enumerator ProcessInfoRequestSignal
enumerator TrapAnswerSignal
enumerator TrapExceptionSignal
enumerator FlushMonitorSignal
enumerator FlushInfoMonitorSignal

Functions

void mailbox_init(Mailbox *mbox)

Initialize the mailbox.

Parameters:
  • mbox – the mailbox to initialize.

size_t mailbox_len(Mailbox *mbox)

Compute the mailbox length, in messages.

To be called from the process only.

Parameters:
  • mbox – the mailbox to get the length of.

size_t mailbox_size(Mailbox *mbox)

Compute the mailbox size, in bytes.

To be called from the process only.

Parameters:
  • mbox – the mailbox to get the size of.

MailboxMessage *mailbox_process_outer_list(Mailbox *mbox)

Process the outer list of messages.

To be called from the process only

Parameters:
  • mbox – the mailbox to work with

Returns:

the signal messages in received order.

void mailbox_send(Context *c, term t)

Sends a message to a certain mailbox.

Sends a term to a certain process or port mailbox. Can be called from another process. Cannot be called from a task or from ISR.

Parameters:
  • c – the process context.

  • t – the term that will be sent.

void mailbox_send_term_signal(Context *c, enum MessageType type, term t)

Sends a term-based signal to a certain mailbox.

Parameters:
  • c – the process context.

  • type – the type of the signal

  • t – the term added to the message

void mailbox_send_built_in_atom_signal(Context *c, enum MessageType type, term atom)

Sends a built-in atom signal to a certain mailbox.

Parameters:
  • c – the process context.

  • type – the type of the signal

  • atom – the built-in atom

void mailbox_send_built_in_atom_request_signal(Context *c, enum MessageType type, int32_t sender_pid, term atom)

Sends a built-in atom-based request signal to a certain mailbox.

Parameters:
  • c – the process context.

  • type – the type of the signal

  • sender_pid – the sender of the signal (to get the answer)

  • atom – the built-in atom

void mailbox_send_ref_signal(Context *c, enum MessageType type, uint64_t ref_ticks)

Sends a ref signal to a certain mailbox.

Parameters:
  • c – the process context.

  • type – the type of the signal

  • ref_ticks – the ref

void mailbox_send_empty_body_signal(Context *c, enum MessageType type)

Sends an empty body signal to a certain mailbox.

Parameters:
  • c – the process context.

  • type – the type of the signal

void mailbox_reset(Mailbox *mbox)

Reset mailbox receive pointer.

To be called from the process only.

Parameters:
  • mbox – the mailbox to work with

void mailbox_next(Mailbox *mbox)

Advance pointer to next message in a receive loop.

To be called from the process only.

Parameters:
  • mbox – the mailbox to work with

static inline bool mailbox_has_next(Mailbox *mbox)

Determine if there is a next item in message list.

To be called from the process only.

Parameters:
  • mbox – the mailbox to test

Returns:

true if peek would succeed.

bool mailbox_peek(Context *ctx, term *out)

Gets next message from a mailbox (without removing it).

Peek the mailbox and retrieve a term that has been previously queued on a certain process or driver mailbox. To be called from the process only.

Parameters:
  • ctx – the calling context, owning the mailbox and where the message should be copied to.

  • out – the allocated term.

Returns:

true if a term was available

MailboxMessage *mailbox_take_message(Mailbox *mbox)

Take next message from mailbox.

Remove the first message from the mailbox and return it. To be called from the process only. This function is intended for some corner cases, such as certain port drivers.

Parameters:
  • mbox – the mailbox to take the next message from.

Message *mailbox_first(Mailbox *mbox)

Get first message from mailbox.

Get the first message and sets the receive pointer to it so it can be removed later. Used by ports & drivers. To be called from the process only.

Parameters:
  • mbox – the mailbox to get the current message from.

Returns:

first message or NULL.

void mailbox_destroy(Mailbox *mbox, Heap *heap)

Free memory associated with a mailbox.

All messages in the mailbox will be freed or appended to the heap.

Parameters:
  • mbox – the mailbox to free.

  • heap – the heap to add messages to.

MailboxMessage *mailbox_message_create_from_term(enum MessageType type, term t)

Allocate and serialize a term to a mailbox message.

Can be called from a task or even ISR (provided malloc works).

Parameters:
  • type – the message type, can be NormalMessage or a signal type

  • t – the term that will be sent

void mailbox_message_dispose(MailboxMessage *m, Heap *heap)

Dispose a (processed) mailbox message. The message will be freed or appended to current heap and will be destroyed on garbage collect. This function is called by mailbox_remove and is only needed for signal messages.

Parameters:
  • m – the message to free.

  • heap – heap to append the message to.

static inline void mailbox_remove_message(Mailbox *mbox, Heap *heap)

Remove next message from mailbox.

Discard a term that has been previously queued on a certain process or driver mailbox. To be called from the process only. Term messages are actually added as fragments to the heap and will be gone at next GC.

Parameters:
  • mbox – the mailbox to remove next message from.

  • heap – the heap to add messages to.

void mailbox_crashdump(Context *ctx)

Output mailbox to stderr for crashdump reporting.

Parameters:
  • ctx – the owner of the mailbox to dump

struct MailboxMessage
#include <mailbox.h>

Collaboration diagram for MailboxMessage:

digraph {
    graph [bgcolor="#00000000"]
    node [shape=rectangle style=filled fillcolor="#FFFFFF" font=Helvetica padding=2]
    edge [color="#1414CE"]
    "1" [label="MailboxMessage" tooltip="MailboxMessage" fillcolor="#BFBFBF"]
    "1" -> "1" [dir=forward tooltip="usage"]
}

Public Members

MailboxMessage *next
enum MessageType type
term *heap_fragment_end
union MailboxMessage.[anonymous] [anonymous]
struct Message
#include <mailbox.h>

Collaboration diagram for Message:

digraph {
    graph [bgcolor="#00000000"]
    node [shape=rectangle style=filled fillcolor="#FFFFFF" font=Helvetica padding=2]
    edge [color="#1414CE"]
    "1" [label="Message" tooltip="Message" fillcolor="#BFBFBF"]
    "2" [label="MailboxMessage" tooltip="MailboxMessage"]
    "1" -> "2" [dir=forward tooltip="usage"]
    "2" -> "2" [dir=forward tooltip="usage"]
}

Public Members

MailboxMessage base
term message
term *heap_end
term storage[]
struct TermSignal
#include <mailbox.h>

Collaboration diagram for TermSignal:

digraph {
    graph [bgcolor="#00000000"]
    node [shape=rectangle style=filled fillcolor="#FFFFFF" font=Helvetica padding=2]
    edge [color="#1414CE"]
    "1" [label="TermSignal" tooltip="TermSignal" fillcolor="#BFBFBF"]
    "2" [label="MailboxMessage" tooltip="MailboxMessage"]
    "1" -> "2" [dir=forward tooltip="usage"]
    "2" -> "2" [dir=forward tooltip="usage"]
}

Public Members

MailboxMessage base
term signal_term
term *heap_end
term storage[]
struct BuiltInAtomSignal
#include <mailbox.h>

Collaboration diagram for BuiltInAtomSignal:

digraph {
    graph [bgcolor="#00000000"]
    node [shape=rectangle style=filled fillcolor="#FFFFFF" font=Helvetica padding=2]
    edge [color="#1414CE"]
    "1" [label="BuiltInAtomSignal" tooltip="BuiltInAtomSignal" fillcolor="#BFBFBF"]
    "2" [label="MailboxMessage" tooltip="MailboxMessage"]
    "1" -> "2" [dir=forward tooltip="usage"]
    "2" -> "2" [dir=forward tooltip="usage"]
}

Public Members

MailboxMessage base
term atom
struct BuiltInAtomRequestSignal
#include <mailbox.h>

Collaboration diagram for BuiltInAtomRequestSignal:

digraph {
    graph [bgcolor="#00000000"]
    node [shape=rectangle style=filled fillcolor="#FFFFFF" font=Helvetica padding=2]
    edge [color="#1414CE"]
    "1" [label="BuiltInAtomRequestSignal" tooltip="BuiltInAtomRequestSignal" fillcolor="#BFBFBF"]
    "2" [label="MailboxMessage" tooltip="MailboxMessage"]
    "1" -> "2" [dir=forward tooltip="usage"]
    "2" -> "2" [dir=forward tooltip="usage"]
}

Public Members

MailboxMessage base
int32_t sender_pid
term atom
struct RefSignal
#include <mailbox.h>

Collaboration diagram for RefSignal:

digraph {
    graph [bgcolor="#00000000"]
    node [shape=rectangle style=filled fillcolor="#FFFFFF" font=Helvetica padding=2]
    edge [color="#1414CE"]
    "1" [label="RefSignal" tooltip="RefSignal" fillcolor="#BFBFBF"]
    "2" [label="MailboxMessage" tooltip="MailboxMessage"]
    "1" -> "2" [dir=forward tooltip="usage"]
    "2" -> "2" [dir=forward tooltip="usage"]
}

Public Members

MailboxMessage base
uint64_t ref_ticks
struct Mailbox
#include <mailbox.h>

Collaboration diagram for Mailbox:

digraph {
    graph [bgcolor="#00000000"]
    node [shape=rectangle style=filled fillcolor="#FFFFFF" font=Helvetica padding=2]
    edge [color="#1414CE"]
    "2" [label="MailboxMessage" tooltip="MailboxMessage"]
    "1" [label="Mailbox" tooltip="Mailbox" fillcolor="#BFBFBF"]
    "2" -> "2" [dir=forward tooltip="usage"]
    "1" -> "2" [dir=forward tooltip="usage"]
}

Public Members

MailboxMessage *ATOMIC outer_first
MailboxMessage *inner_first
MailboxMessage *inner_last
MailboxMessage *receive_pointer
MailboxMessage *receive_pointer_prev