context.h
Include dependency graph for context.h:
![digraph {
graph [bgcolor="#00000000"]
node [shape=rectangle style=filled fillcolor="#FFFFFF" font=Helvetica padding=2]
edge [color="#1414CE"]
"7" [label="stdbool.h" tooltip="stdbool.h"]
"4" [label="atom.h" tooltip="atom.h"]
"10" [label="assert.h" tooltip="assert.h"]
"15" [label="synclist.h" tooltip="synclist.h"]
"3" [label="stdint.h" tooltip="stdint.h"]
"5" [label="stdlib.h" tooltip="stdlib.h"]
"1" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/context.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/context.h" fillcolor="#BFBFBF"]
"21" [label="utils.h" tooltip="utils.h"]
"13" [label="ets.h" tooltip="ets.h"]
"6" [label="atom_table.h" tooltip="atom_table.h"]
"9" [label="term_typedef.h" tooltip="term_typedef.h"]
"22" [label="stddef.h" tooltip="stddef.h"]
"11" [label="limits.h" tooltip="limits.h"]
"23" [label="refc_binary.h" tooltip="refc_binary.h"]
"19" [label="string.h" tooltip="string.h"]
"25" [label="mailbox.h" tooltip="mailbox.h"]
"18" [label="term.h" tooltip="term.h"]
"8" [label="erl_nif.h" tooltip="erl_nif.h"]
"24" [label="resources.h" tooltip="resources.h"]
"17" [label="smp.h" tooltip="smp.h"]
"2" [label="globalcontext.h" tooltip="globalcontext.h"]
"20" [label="memory.h" tooltip="memory.h"]
"16" [label="stdio.h" tooltip="stdio.h"]
"26" [label="timer_list.h" tooltip="timer_list.h"]
"14" [label="list.h" tooltip="list.h"]
"12" [label="inttypes.h" tooltip="inttypes.h"]
"4" -> "3" [dir=forward tooltip="include"]
"4" -> "5" [dir=forward tooltip="include"]
"15" -> "16" [dir=forward tooltip="include"]
"15" -> "14" [dir=forward tooltip="include"]
"15" -> "17" [dir=forward tooltip="include"]
"1" -> "2" [dir=forward tooltip="include"]
"1" -> "14" [dir=forward tooltip="include"]
"1" -> "25" [dir=forward tooltip="include"]
"1" -> "17" [dir=forward tooltip="include"]
"1" -> "18" [dir=forward tooltip="include"]
"1" -> "26" [dir=forward tooltip="include"]
"21" -> "22" [dir=forward tooltip="include"]
"21" -> "16" [dir=forward tooltip="include"]
"21" -> "5" [dir=forward tooltip="include"]
"13" -> "14" [dir=forward tooltip="include"]
"13" -> "15" [dir=forward tooltip="include"]
"13" -> "18" [dir=forward tooltip="include"]
"6" -> "7" [dir=forward tooltip="include"]
"6" -> "4" [dir=forward tooltip="include"]
"9" -> "10" [dir=forward tooltip="include"]
"9" -> "11" [dir=forward tooltip="include"]
"9" -> "12" [dir=forward tooltip="include"]
"9" -> "3" [dir=forward tooltip="include"]
"23" -> "7" [dir=forward tooltip="include"]
"23" -> "5" [dir=forward tooltip="include"]
"23" -> "14" [dir=forward tooltip="include"]
"23" -> "24" [dir=forward tooltip="include"]
"25" -> "7" [dir=forward tooltip="include"]
"25" -> "14" [dir=forward tooltip="include"]
"25" -> "9" [dir=forward tooltip="include"]
"25" -> "21" [dir=forward tooltip="include"]
"18" -> "7" [dir=forward tooltip="include"]
"18" -> "3" [dir=forward tooltip="include"]
"18" -> "16" [dir=forward tooltip="include"]
"18" -> "5" [dir=forward tooltip="include"]
"18" -> "19" [dir=forward tooltip="include"]
"18" -> "20" [dir=forward tooltip="include"]
"18" -> "23" [dir=forward tooltip="include"]
"18" -> "21" [dir=forward tooltip="include"]
"18" -> "9" [dir=forward tooltip="include"]
"8" -> "9" [dir=forward tooltip="include"]
"24" -> "5" [dir=forward tooltip="include"]
"24" -> "8" [dir=forward tooltip="include"]
"24" -> "14" [dir=forward tooltip="include"]
"24" -> "20" [dir=forward tooltip="include"]
"17" -> "7" [dir=forward tooltip="include"]
"2" -> "3" [dir=forward tooltip="include"]
"2" -> "4" [dir=forward tooltip="include"]
"2" -> "6" [dir=forward tooltip="include"]
"2" -> "8" [dir=forward tooltip="include"]
"2" -> "13" [dir=forward tooltip="include"]
"2" -> "14" [dir=forward tooltip="include"]
"2" -> "25" [dir=forward tooltip="include"]
"2" -> "17" [dir=forward tooltip="include"]
"2" -> "15" [dir=forward tooltip="include"]
"2" -> "18" [dir=forward tooltip="include"]
"2" -> "26" [dir=forward tooltip="include"]
"20" -> "3" [dir=forward tooltip="include"]
"20" -> "5" [dir=forward tooltip="include"]
"20" -> "8" [dir=forward tooltip="include"]
"20" -> "9" [dir=forward tooltip="include"]
"20" -> "21" [dir=forward tooltip="include"]
"26" -> "7" [dir=forward tooltip="include"]
"26" -> "3" [dir=forward tooltip="include"]
"26" -> "14" [dir=forward tooltip="include"]
"14" -> "7" [dir=forward tooltip="include"]
}](../../../_images/graphviz-a42fb41d088f741e63a0c09b30a8091ca49cbc6f.png)
This graph shows which files directly or indirectly include context.h:
![digraph {
graph [bgcolor="#00000000"]
node [shape=rectangle style=filled fillcolor="#FFFFFF" font=Helvetica padding=2]
edge [color="#1414CE"]
"3" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/bif.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/bif.c"]
"2" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/bif.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/bif.h"]
"27" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/platform_nifs.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/platform_nifs.h"]
"14" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/posix_nifs.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/posix_nifs.c"]
"21" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/inet.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/inet.c"]
"20" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/inet.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/inet.h"]
"40" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/scheduler.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/scheduler.h"]
"6" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/context.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/context.c"]
"1" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/context.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/context.h" fillcolor="#BFBFBF"]
"38" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/port.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/port.c"]
"39" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/port.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/port.h"]
"17" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/ets.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/ets.c"]
"29" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/stacktrace.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/stacktrace.c"]
"28" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/stacktrace.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/stacktrace.h"]
"15" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/refc_binary.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/refc_binary.c"]
"41" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/mailbox.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/mailbox.c"]
"4" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/module.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/module.c"]
"26" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/module.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/module.h"]
"25" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/term.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/term.c"]
"23" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/interop.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/interop.c"]
"13" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/otp_ssl.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/otp_ssl.c"]
"19" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/interop.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/interop.h"]
"35" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/otp_ssl.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/otp_ssl.h"]
"37" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/portnifloader.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/portnifloader.c"]
"36" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/portnifloader.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/portnifloader.h"]
"16" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/resources.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/resources.c"]
"24" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/otp_crypto.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/otp_crypto.c"]
"32" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/otp_crypto.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/otp_crypto.h"]
"22" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/otp_net.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/otp_net.c"]
"33" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/otp_net.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/otp_net.h"]
"10" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/erl_nif_priv.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/erl_nif_priv.h"]
"30" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/sys.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/sys.h"]
"5" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/nifs.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/nifs.c"]
"31" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/nifs.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/nifs.h"]
"8" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/debug.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/debug.c"]
"7" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/debug.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/debug.h"]
"11" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/globalcontext.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/globalcontext.c"]
"9" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/memory.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/memory.c"]
"12" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/otp_socket.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/otp_socket.c"]
"34" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/otp_socket.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/otp_socket.h"]
"18" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/externalterm.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/externalterm.c"]
"2" -> "3" [dir=back tooltip="include"]
"2" -> "4" [dir=back tooltip="include"]
"2" -> "5" [dir=back tooltip="include"]
"27" -> "5" [dir=back tooltip="include"]
"20" -> "21" [dir=back tooltip="include"]
"20" -> "22" [dir=back tooltip="include"]
"20" -> "12" [dir=back tooltip="include"]
"20" -> "13" [dir=back tooltip="include"]
"40" -> "11" [dir=back tooltip="include"]
"40" -> "41" [dir=back tooltip="include"]
"40" -> "5" [dir=back tooltip="include"]
"40" -> "12" [dir=back tooltip="include"]
"1" -> "2" [dir=back tooltip="include"]
"1" -> "6" [dir=back tooltip="include"]
"1" -> "7" [dir=back tooltip="include"]
"1" -> "10" [dir=back tooltip="include"]
"1" -> "17" [dir=back tooltip="include"]
"1" -> "18" [dir=back tooltip="include"]
"1" -> "11" [dir=back tooltip="include"]
"1" -> "19" [dir=back tooltip="include"]
"1" -> "9" [dir=back tooltip="include"]
"1" -> "4" [dir=back tooltip="include"]
"1" -> "26" [dir=back tooltip="include"]
"1" -> "5" [dir=back tooltip="include"]
"1" -> "31" [dir=back tooltip="include"]
"1" -> "24" [dir=back tooltip="include"]
"1" -> "22" [dir=back tooltip="include"]
"1" -> "12" [dir=back tooltip="include"]
"1" -> "13" [dir=back tooltip="include"]
"1" -> "38" [dir=back tooltip="include"]
"1" -> "39" [dir=back tooltip="include"]
"1" -> "36" [dir=back tooltip="include"]
"1" -> "15" [dir=back tooltip="include"]
"1" -> "16" [dir=back tooltip="include"]
"1" -> "40" [dir=back tooltip="include"]
"1" -> "28" [dir=back tooltip="include"]
"1" -> "25" [dir=back tooltip="include"]
"39" -> "21" [dir=back tooltip="include"]
"39" -> "5" [dir=back tooltip="include"]
"39" -> "22" [dir=back tooltip="include"]
"39" -> "12" [dir=back tooltip="include"]
"39" -> "13" [dir=back tooltip="include"]
"39" -> "38" [dir=back tooltip="include"]
"28" -> "29" [dir=back tooltip="include"]
"26" -> "2" [dir=back tooltip="include"]
"26" -> "4" [dir=back tooltip="include"]
"26" -> "5" [dir=back tooltip="include"]
"26" -> "27" [dir=back tooltip="include"]
"26" -> "28" [dir=back tooltip="include"]
"26" -> "30" [dir=back tooltip="include"]
"26" -> "25" [dir=back tooltip="include"]
"19" -> "20" [dir=back tooltip="include"]
"19" -> "23" [dir=back tooltip="include"]
"19" -> "5" [dir=back tooltip="include"]
"19" -> "24" [dir=back tooltip="include"]
"19" -> "22" [dir=back tooltip="include"]
"19" -> "12" [dir=back tooltip="include"]
"19" -> "13" [dir=back tooltip="include"]
"19" -> "14" [dir=back tooltip="include"]
"19" -> "25" [dir=back tooltip="include"]
"35" -> "13" [dir=back tooltip="include"]
"36" -> "37" [dir=back tooltip="include"]
"32" -> "24" [dir=back tooltip="include"]
"33" -> "22" [dir=back tooltip="include"]
"10" -> "6" [dir=back tooltip="include"]
"10" -> "11" [dir=back tooltip="include"]
"10" -> "9" [dir=back tooltip="include"]
"10" -> "12" [dir=back tooltip="include"]
"10" -> "13" [dir=back tooltip="include"]
"10" -> "14" [dir=back tooltip="include"]
"10" -> "15" [dir=back tooltip="include"]
"10" -> "16" [dir=back tooltip="include"]
"30" -> "6" [dir=back tooltip="include"]
"30" -> "11" [dir=back tooltip="include"]
"30" -> "4" [dir=back tooltip="include"]
"30" -> "5" [dir=back tooltip="include"]
"30" -> "12" [dir=back tooltip="include"]
"30" -> "16" [dir=back tooltip="include"]
"31" -> "4" [dir=back tooltip="include"]
"31" -> "5" [dir=back tooltip="include"]
"31" -> "24" [dir=back tooltip="include"]
"31" -> "32" [dir=back tooltip="include"]
"31" -> "22" [dir=back tooltip="include"]
"31" -> "33" [dir=back tooltip="include"]
"31" -> "12" [dir=back tooltip="include"]
"31" -> "34" [dir=back tooltip="include"]
"31" -> "13" [dir=back tooltip="include"]
"31" -> "35" [dir=back tooltip="include"]
"31" -> "36" [dir=back tooltip="include"]
"31" -> "14" [dir=back tooltip="include"]
"7" -> "8" [dir=back tooltip="include"]
"7" -> "9" [dir=back tooltip="include"]
"34" -> "12" [dir=back tooltip="include"]
"34" -> "13" [dir=back tooltip="include"]
}](../../../_images/graphviz-db04a956c9d3d985b5069aff54701299f0a9b268.png)
Context struct and related management functions.
A context represent the state of a running erlang process or port.
Defines
-
MAX_REG 16
Typedefs
-
typedef enum NativeHandlerResult NativeHandlerResult
-
typedef NativeHandlerResult (*native_handler_f)(Context *ctx)
Enums
Functions
-
Context *context_new(GlobalContext *glb)
Creates a new context.
Allocates a new Context struct and initialize it. The newly created context is also inserted into the processes table, however it is not scheduled, allowing for further initialization.
- Parameters:
glb – The global context of this virtual machine instance.
- Returns:
created context.
-
void context_destroy(Context *c)
Destroys a context.
Frees context resources and memory and removes it from the processes table. This should be called from the scheduler only. To actually delete a context that was created with context_new, use scheduler_terminate.
- Parameters:
c – the context that will be destroyed.
-
static inline void context_ensure_fpregs(Context *c)
Ensure we have FP registers, allocating them if necessary.
- Parameters:
c – context fo allocate FP registers for
-
int context_execute_loop(Context *ctx, Module *mod, const char *function_name, int arity)
Starts executing a function.
Start executing bytecode for the specified function, this function will block until it terminates. The outcome is saved to x[0] register.
- Parameters:
ctx – the context that will be used to run the specified functions, x registers must be set to function arguments.
mod – the module name C string.
function_name – the function name C string.
arity – the function arity (number of arguments that are required).
- Returns:
1 if an error occurred, otherwise 0 is always returned.
-
static inline int context_is_port_driver(const Context *ctx)
Returns 1 if the context is a port driver.
Checks if the given context has a native_handler or not.
- Parameters:
ctx – a valid context
- Returns:
1 if ctx is a port driver, otherwise 0 is returned.
-
static inline void context_clean_registers(Context *ctx, int live)
Cleans up unused registers.
Sets to NIL unused registers, x[0] - x[live - 1] will not be overwritten.
- Parameters:
ctx – a valid context
live – number of used registers
-
static inline term *context_stack_base(const Context *ctx)
Returns a context’s stack base.
Used for stack traces
- Parameters:
ctx – a valid context.
- Returns:
the stack base
-
static inline size_t context_stack_size(const Context *ctx)
Returns a context’s stack size.
Return the number of terms currently on the stack. Used for stack traces.
- Parameters:
ctx – a valid context.
- Returns:
stack size in terms
-
static inline size_t context_avail_free_memory(const Context *ctx)
Returns available free memory in term units.
Returns the number of terms that can fit either on the heap.
- Parameters:
ctx – a valid context.
- Returns:
available free memory that is avail_size_in_bytes / sizeof(term).
-
static inline bool context_is_term_equal_to_atom_string(Context *ctx, term atom_a, AtomString atom_string_b)
Compares a term with an AtomString.
Checks if the given term and the given AtomString refers to the same atom. This function is just a shortcut that uses the corresponding funtion from globalcontext.
- Parameters:
ctx – the current Context.
atom_a – any term of any type, when it is not an atom false is always returned.
atom_string_b – an atom string, which is the atom length followed by atom characters.
- Returns:
true if they both refer to the same atom, otherwise false.
-
size_t context_message_queue_len(Context *ctx)
Returns number of messages in the process’s mailbox.
- Parameters:
ctx – a valid context.
- Returns:
the number of messages in the process’s mailbox
-
size_t context_size(Context *ctx)
Returns total amount of size (in byes) occupied by the process.
- Parameters:
ctx – a valid context.
- Returns:
total amount of size (in byes) occupied by the process
-
void context_update_flags(Context *ctx, int mask, int value)
Set or clear a flag on another context.
atomically update flags <- (flags & mask) | value
- Parameters:
ctx – the context to set/clear flag on.
mask – the mask to apply on flags
value – the value to set
-
static inline int context_get_flags(Context *ctx, int mask)
Get flags on a given context.
- Parameters:
ctx – the context to get flags on.
mask – the mask to apply on flags
-
void context_process_kill_signal(Context *ctx, struct TermSignal *signal)
Process a kill signal, setting the exit reason and changing the killed flag.
- Parameters:
ctx – the context being executed
signal – the kill message
-
void context_process_process_info_request_signal(Context *ctx, struct BuiltInAtomRequestSignal *signal)
Process a process info request signal.
- Parameters:
ctx – the context being executed
signal – the kill message
-
bool context_process_signal_trap_answer(Context *ctx, struct TermSignal *signal)
Process a trap answer signal.
- Parameters:
ctx – the context being executed
signal – the answer message
- Returns:
true
if successful,false
in case of memory error
-
void context_process_flush_monitor_signal(Context *ctx, uint64_t ref_ticks, bool info)
Process a flush monitor signal.
- Parameters:
ctx – the context being executed
ref_ticks – the monitor reference
info – whether to return FALSE_ATOM if no message was flushed.
-
bool context_get_process_info(Context *ctx, term *out, term atom_key)
Get process information.
- Parameters:
ctx – the context being executed
out – the answer term
atom_key – the key representing the info to get
- Returns:
true
if successful,false
in case of an error in which case *out is filled with an exception atom
-
int context_link(Context *ctx, term monitor_pid)
Half-link process to another process.
Caller must hold the global process lock. This creates one half of the link.
- Parameters:
ctx – context to link
monitor_pid – process to link ctx to
- Returns:
0 on success
-
uint64_t context_monitor(Context *ctx, term monitor_pid)
Create a monitor on a process.
Caller must hold the global process lock.
- Parameters:
ctx – context to monitor
monitor_pid – monitoring process
- Returns:
the ref ticks
-
struct ResourceMonitor *context_resource_monitor(Context *ctx, void *resource)
Create a resource monitor on a process.
Caller must hold the global process lock. The returned resource monitor is not added to the monitors list on the resource type.
- Parameters:
ctx – context to monitor
resource – resource object
- Returns:
the resource monitor
-
struct Context
- #include <context.h>
Collaboration diagram for Context:
Public Members
-
GlobalContext *global
-
Heap heap
-
term *e
-
term x[16 + 1]
-
struct ListHead extended_x_regs
-
struct ListHead processes_list_head
-
struct ListHead processes_table_head
-
int32_t process_id
-
struct TimerListItem timer_list_head
-
struct ListHead monitors_head
-
avm_float_t *fr
-
size_t min_heap_size
-
size_t max_heap_size
-
enum HeapGrowthStrategy heap_growth_strategy
-
unsigned long cp
-
const void *saved_ip
-
void *restore_trap_handler
-
struct ListHead dictionary
-
native_handler_f native_handler
-
uint64_t reductions
-
unsigned int leader
-
unsigned int has_min_heap_size
-
unsigned int has_max_heap_size
-
bool trap_exit
-
unsigned int trace_calls
-
unsigned int trace_call_args
-
unsigned int trace_returns
-
unsigned int trace_send
-
unsigned int trace_receive
-
enum ContextFlags flags
-
void *platform_data
-
term group_leader
-
term bs
-
size_t bs_offset
-
term exit_reason
-
GlobalContext *global
-
struct Monitor
- #include <context.h>
Collaboration diagram for Monitor:
A regular monitor or a half link.
-
struct ResourceMonitor
- #include <context.h>
Collaboration diagram for ResourceMonitor:
A resource monitor.
-
struct ExtendedRegister
- #include <context.h>
Collaboration diagram for ExtendedRegister: