diff options
author | Giampaolo Rodola <g.rodola@gmail.com> | 2020-01-09 16:24:10 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-09 16:24:10 -0800 |
commit | 3880e3f88d886234b3a4347a7ae3479cbecc6aaa (patch) | |
tree | 7504b63ca1c0156ae6d646ef5efd4086c62f8ce7 /psutil/_psutil_common.c | |
parent | 90b4cef4b62125c8a42bef4a9db9b9e17459bd6d (diff) | |
download | psutil-3880e3f88d886234b3a4347a7ae3479cbecc6aaa.tar.gz |
[Windows] rewrite of open_files() (#1660)
Diffstat (limited to 'psutil/_psutil_common.c')
-rw-r--r-- | psutil/_psutil_common.c | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/psutil/_psutil_common.c b/psutil/_psutil_common.c index f67088b5..890d515f 100644 --- a/psutil/_psutil_common.c +++ b/psutil/_psutil_common.c @@ -153,7 +153,8 @@ psutil_setup(void) { // Needed to make these globally visible. int PSUTIL_WINVER; -SYSTEM_INFO PSUTIL_SYSTEM_INFO; +SYSTEM_INFO PSUTIL_SYSTEM_INFO; +CRITICAL_SECTION PSUTIL_CRITICAL_SECTION; #define NT_FACILITY_MASK 0xfff #define NT_FACILITY_SHIFT 16 @@ -326,22 +327,14 @@ psutil_set_winver() { return 0; } - -static int -psutil_load_sysinfo() { - GetSystemInfo(&PSUTIL_SYSTEM_INFO); - return 0; -} - - int psutil_load_globals() { if (psutil_loadlibs() != 0) return 1; if (psutil_set_winver() != 0) return 1; - if (psutil_load_sysinfo() != 0) - return 1; + GetSystemInfo(&PSUTIL_SYSTEM_INFO); + InitializeCriticalSection(&PSUTIL_CRITICAL_SECTION); return 0; } #endif // PSUTIL_WINDOWS |