File tree Expand file tree Collapse file tree 3 files changed +23
-2
lines changed
FoundationEssentials/ProcessInfo Expand file tree Collapse file tree 3 files changed +23
-2
lines changed Original file line number Diff line number Diff line change @@ -44,6 +44,10 @@ final class _ProcessInfo: Sendable {
4444 }
4545
4646 var environment : [ String : String ] {
47+ _platform_shims_lock_environ ( )
48+ defer {
49+ _platform_shims_unlock_environ ( )
50+ }
4751 var results : [ String : String ] = [ : ]
4852 guard var environments: UnsafeMutablePointer < UnsafeMutablePointer < CChar > ? > =
4953 _platform_shims_get_environ ( ) else {
Original file line number Diff line number Diff line change 2424#include <libkern/OSThermalNotification.h>
2525#endif
2626
27- INTERNAL char * * _platform_shims_get_environ ();
27+ INTERNAL char * _Nullable * _Nullable _platform_shims_get_environ () ;
28+
29+ INTERNAL void _platform_shims_lock_environ ();
30+ INTERNAL void _platform_shims_unlock_environ ();
2831
2932#if __has_include (< libkern /OSThermalNotification .h > )
3033typedef enum {
@@ -45,7 +48,7 @@ typedef enum {
4548} _platform_shims_OSThermalPressureLevel ;
4649
4750
48- INTERNAL const char * _platform_shims_kOSThermalNotificationPressureLevelName ();
51+ INTERNAL const char * _Nonnull _platform_shims_kOSThermalNotificationPressureLevelName ();
4952#endif
5053
5154#endif /* CSHIMS_PLATFORM_SHIMS */
Original file line number Diff line number Diff line change 1919extern char * * environ ;
2020#endif
2121
22+ #if __has_include (< libc_private .h > )
23+ #import <libc_private.h>
24+ void _platform_shims_lock_environ () {
25+ environ_lock_np ();
26+ }
27+
28+ void _platform_shims_unlock_environ () {
29+ environ_unlock_np ();
30+ }
31+ #else
32+ void _platform_shims_lock_environ () { /* noop */ }
33+ void _platform_shims_unlock_environ () { /* noop */ }
34+ #endif
35+
2236char * *
2337_platform_shims_get_environ ()
2438{
You can’t perform that action at this time.
0 commit comments