Backed out changeset b71c8c052463 (bug 1943846) for causing mass failures. CLOSED...
[gecko.git] / tools / profiler / rust-api / src / thread.rs
blob353469a4bbaedbbaf2a0b4c0a7a026abb9b789f2
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
3  * You can obtain one at http://mozilla.org/MPL/2.0/. */
5 ///! Profiler API for thread registration and unregistration.
6 use crate::gecko_bindings::bindings;
7 use std::ffi::CString;
9 /// Register a thread with the Gecko Profiler.
10 pub fn register_thread(thread_name: &str) {
11     let name = CString::new(thread_name).unwrap();
12     unsafe {
13         // gecko_profiler_register_thread copies the passed name here.
14         bindings::gecko_profiler_register_thread(name.as_ptr());
15     }
18 /// Unregister a thread with the Gecko Profiler.
19 pub fn unregister_thread() {
20     unsafe {
21         bindings::gecko_profiler_unregister_thread();
22     }