Raxol.Core.CompilerState (Raxol v2.0.1)

View Source

Thread-safe ETS table management for parallel compilation.

Fixes race conditions causing: "table identifier does not refer to an existing ETS table" during parallel compilation processes accessing shared ETS tables.

REFACTORED: All try/rescue blocks replaced with functional patterns.

Summary

Functions

Safe ETS delete with existence check.

Safe ETS table deletion with existence check.

Safe ETS insert with existence check.

Safe ETS lookup with existence check.

Functions

ensure_table(name, opts \\ [:named_table, :public, :set, read_concurrency: true])

Ensure ETS table exists with safe concurrency.

This function handles race conditions where multiple processes might try to create the same ETS table simultaneously during parallel compilation.

safe_delete(table, key)

Safe ETS delete with existence check.

Performs ETS delete operations with proper error handling for cases where the table might have been deleted by another process.

safe_delete_table(table)

Safe ETS table deletion with existence check.

Deletes an entire ETS table with proper error handling.

safe_insert(table, data)

Safe ETS insert with existence check.

Performs ETS insert operations with proper error handling for cases where the table might have been deleted by another process.

safe_lookup(table, key)

Safe ETS lookup with existence check.

Performs ETS lookup operations with proper error handling for cases where the table might have been deleted by another process.