Add note about safety of std::env::set_var
on Windows
This commit is contained in:
parent
5d8f9b4dc1
commit
8cf4980648
@ -320,11 +320,14 @@ impl Error for VarError {
|
|||||||
///
|
///
|
||||||
/// This function is safe to call in a single-threaded program.
|
/// This function is safe to call in a single-threaded program.
|
||||||
///
|
///
|
||||||
/// In multi-threaded programs, you must ensure that are no other threads
|
/// This function is also always safe to call on Windows, in single-threaded
|
||||||
/// concurrently writing or *reading*(!) from the environment through functions
|
/// and multi-threaded programs.
|
||||||
/// other than the ones in this module. You are responsible for figuring out
|
///
|
||||||
/// how to achieve this, but we strongly suggest not using `set_var` or
|
/// In multi-threaded programs on other operating systems, you must ensure that
|
||||||
/// `remove_var` in multi-threaded programs at all.
|
/// are no other threads concurrently writing or *reading*(!) from the
|
||||||
|
/// environment through functions other than the ones in this module. You are
|
||||||
|
/// responsible for figuring out how to achieve this, but we strongly suggest
|
||||||
|
/// not using `set_var` or `remove_var` in multi-threaded programs at all.
|
||||||
///
|
///
|
||||||
/// Most C libraries, including libc itself, do not advertise which functions
|
/// Most C libraries, including libc itself, do not advertise which functions
|
||||||
/// read from the environment. Even functions from the Rust standard library do
|
/// read from the environment. Even functions from the Rust standard library do
|
||||||
@ -379,6 +382,9 @@ unsafe fn _set_var(key: &OsStr, value: &OsStr) {
|
|||||||
///
|
///
|
||||||
/// This function is safe to call in a single-threaded program.
|
/// This function is safe to call in a single-threaded program.
|
||||||
///
|
///
|
||||||
|
/// This function is also always safe to call on Windows, in single-threaded
|
||||||
|
/// and multi-threaded programs.
|
||||||
|
///
|
||||||
/// In multi-threaded programs, you must ensure that are no other threads
|
/// In multi-threaded programs, you must ensure that are no other threads
|
||||||
/// concurrently writing or *reading*(!) from the environment through functions
|
/// concurrently writing or *reading*(!) from the environment through functions
|
||||||
/// other than the ones in this module. You are responsible for figuring out
|
/// other than the ones in this module. You are responsible for figuring out
|
||||||
|
Loading…
x
Reference in New Issue
Block a user