Skip to content

Extract shared static state #164

Description

@tisonkun

Currently, fastrace can hardly cut a breaking release because static states would have different fully qualified names.

Concretely, we have the following global states:

static NEXT_COLLECT_ID: AtomicUsize = AtomicUsize::new(0);
static GLOBAL_COLLECTOR: Mutex<Option<GlobalCollector>> = Mutex::new(None);
static REPORTER_READY: AtomicBool = AtomicBool::new(false);
static COMMAND_BUS: LazyLock<CommandBus<CollectCommand>> = LazyLock::new(CommandBus::new);

thread_local! {
    static COMMAND_SENDER: UnsafeCell<CommandSender<CollectCommand>> = ...;
    static LOCAL_ID_GENERATOR: Cell<(u32, u32)> = ...;
    static LOCAL_SPAN_STACK: Rc<RefCell<LocalSpanStack>> = ...;
}

The first significant shared state is GLOBAL_COLLECTOR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions