在 Windows 中使用 std::shared_mutex 时泄漏句柄
同样的问题在这里: 使用shared_mutex的内存泄漏 但在 Windows 11 中。Windows
句柄未关闭。
#include <iostream>
using namespace std;
#include <shared_mutex>
extern "C" {
#include <processthreadsapi.h>
}
int GetHandleCount() {
HANDLE processHandle = GetCurrentProcess();
unsigned long hCount = 0;
WINBOOL valid = GetProcessHandleCount(processHandle, &hCount);
if (valid) {
return hCount;
}
return -1;
}
class foo {
public:
void bar() {
std::unique_lock lock(m_mtx);
}
std::shared_mutex m_mtx;
};
int main() {
cout << "Handles to start with=" << GetHandleCount() << std::endl;
for (int i = 0; i < 1000; i++) {
foo obj;
obj.bar();
std::this_thread::sleep_for(std::chrono::milliseconds{1}); // added this line to address Mgetz' comment
}
cout << "Handles when finished=" << GetHandleCount() << std::endl;
}
输出是:
Handles to start with=45
Handles when finished=2045
Windows 任务管理器显示数量迅速增加 手柄。
编译:
g++ -std=c++17 -O0 -g3 -Wall -c -fmessage-length=0 -o "src\\Testumgebung.o" "..\\src\\Testumgebung.cpp"
g++ -o Testumgebung.exe "src\\Testumgebung.o" -liphlpapi
我正在使用安装了以下软件包的 msys2 环境:
$ pacman -Q
asciidoc 9.1.0-2
autoconf 2.71-1
autoconf2.13 2.13-3
autogen 5.18.16-1
automake-wrapper 11-1
automake1.10 1.10.3-4
automake1.11 1.11.6-4
automake1.12 1.12.6-4
automake1.13 1.13.4-5
automake1.14 1.14.1-4
automake1.15 1.15.1-2
automake1.16 1.16.3-1
automake1.6 1.6.3-3
automake1.7 1.7.9-3
automake1.8 1.8.5-4
automake1.9 1.9.6-3
base 2020.12-1
bash 5.1.008-1
bash-completion 2.11-1
bison 3.8.1-1
brotli 1.0.9-2
bsdtar 3.5.2-1
btyacc 20210619-1
bzip2 1.0.8-2
ca-certificates 20210119-2
ccache 4.4-1
cmake 3.21.2-1
coreutils 8.32-1
curl 7.79.0-1
dash 0.5.11.4-1
db 5.3.28-3
diffstat 1.64-1
diffutils 3.8-1
docbook-xml 4.5-2
docbook-xsl 1.79.2-1
dos2unix 7.4.2-1
expat 2.4.1-1
file 5.40-2
filesystem 2021.06-1
findutils 4.8.0-1
flex 2.6.4-1
gawk 5.1.0-1
gcc-libs 10.2.0-1
gdb 10.2-3
gdbm 1.21-1
getent 2.18.90-2
gettext 0.19.8.1-1
gettext-devel 0.19.8.1-1
glib2 2.68.4-1
gmp 6.2.1-1
gnupg 2.2.29-1
gperf 3.1-2
grep 3.6-1
groff 1.22.4-1
gzip 1.11-1
heimdal-libs 7.7.0-2
help2man 1.48.5-1
icu 69.1-1
inetutils 1.9.4-2
info 6.8-1
intltool 0.51.0-2
jsoncpp 1.9.4-1
less 590-1
libarchive 3.5.2-1
libargp 20110921-2
libasprintf 0.19.8.1-1
libassuan 2.5.5-1
libatomic_ops 7.6.10-1
libbz2 1.0.8-2
libcrypt 2.1-3
libcurl 7.79.0-1
libdb 5.3.28-3
libedit 20210714_3.1-1
libexpat 2.4.1-1
libffi 3.3-1
libgc 8.0.4-1
libgcrypt 1.9.4-1
libgdbm 1.21-1
libgettextpo 0.19.8.1-1
libgnutls 3.7.2-1
libgpg-error 1.42-1
libgpgme 1.16.0-1
libguile 2.2.7-1
libhogweed 3.7.3-1
libiconv 1.16-2
libiconv-devel 1.16-2
libidn2 2.3.2-1
libintl 0.19.8.1-1
libksba 1.6.0-1
libltdl 2.4.6-11
liblz4 1.9.3-1
liblzma 5.2.5-1
libmetalink 0.1.3-3
libnettle 3.7.3-1
libnghttp2 1.44.0-1
libnpth 1.6-1
libopenssl 1.1.1.l-1
libp11-kit 0.24.0-1
libpcre 8.45-1
libpcre16 8.45-1
libpcre2_16 10.37-1
libpcre2_32 10.37-1
libpcre2_8 10.37-1
libpcre2posix 10.37-1
libpcre32 8.45-1
libpcrecpp 8.45-1
libpcreposix 8.45-1
libpipeline 1.5.3-2
libpsl 0.21.1-2
libreadline 8.1.001-1
librhash 1.4.2-1
libsqlite 3.36.0-2
libssh2 1.10.0-1
libtasn1 4.17.0-2
libtool 2.4.6-11
libunistring 0.9.10-1
libunrar 6.0.7-1
libunrar-devel 6.0.7-1
libutil-linux 2.35.2-1
libuv 1.42.0-1
libxml2 2.9.12-2
libxslt 1.1.34-4
libxxhash 0.8.0-1
libzstd 1.5.0-1
lld 11.0.0-4
llvm 11.0.0-4
m4 1.4.19-1
make 4.3-1
man-db 2.9.4-1
mingw-w64-i686-binutils 2.37-4
mingw-w64-i686-crt-git 9.0.0.6294.f5ac9206e-1
mingw-w64-i686-gcc 10.3.0-5
mingw-w64-i686-gcc-libs 10.3.0-5
mingw-w64-i686-gmp 6.2.1-2
mingw-w64-i686-headers-git 9.0.0.6294.f5ac9206e-1
mingw-w64-i686-isl 0.24-1
mingw-w64-i686-libiconv 1.16-2
mingw-w64-i686-libwinpthread-git 9.0.0.6294.f5ac9206e-1
mingw-w64-i686-mpc 1.2.1-1
mingw-w64-i686-mpfr 4.1.0.p13-1
mingw-w64-i686-windows-default-manifest 6.4-3
mingw-w64-i686-winpthreads-git 9.0.0.6294.f5ac9206e-1
mingw-w64-i686-zlib 1.2.11-9
mingw-w64-i686-zstd 1.5.0-1
mingw-w64-x86_64-assimp 5.0.1-11
mingw-w64-x86_64-binutils 2.37-4
mingw-w64-x86_64-boost 1.77.0-1
mingw-w64-x86_64-brotli 1.0.9-3
mingw-w64-x86_64-bzip2 1.0.8-2
mingw-w64-x86_64-c-ares 1.17.2-1
mingw-w64-x86_64-ca-certificates 20200601-3
mingw-w64-x86_64-cmake 3.21.2-1
mingw-w64-x86_64-crt-git 9.0.0.6294.f5ac9206e-1
mingw-w64-x86_64-curl 7.79.0-1
mingw-w64-x86_64-dbus 1.12.20-3
mingw-w64-x86_64-double-conversion 3.1.5-1
mingw-w64-x86_64-expat 2.4.1-1
mingw-w64-x86_64-fontconfig 2.13.94-1
mingw-w64-x86_64-freeglut 3.2.1-2
mingw-w64-x86_64-freetype 2.11.0-2
mingw-w64-x86_64-gcc 10.3.0-5
mingw-w64-x86_64-gcc-ada 10.3.0-5
mingw-w64-x86_64-gcc-fortran 10.3.0-5
mingw-w64-x86_64-gcc-libgfortran 10.3.0-5
mingw-w64-x86_64-gcc-libs 10.3.0-5
mingw-w64-x86_64-gcc-objc 10.3.0-5
mingw-w64-x86_64-gdb 10.2-2
mingw-w64-x86_64-gdb-multiarch 10.2-2
mingw-w64-x86_64-gettext 0.19.8.1-10
mingw-w64-x86_64-gflags 2.2.2-2
mingw-w64-x86_64-giflib 5.2.1-3
mingw-w64-x86_64-glib2 2.70.0-1
mingw-w64-x86_64-gmp 6.2.1-2
mingw-w64-x86_64-graphite2 1.3.14-2
mingw-w64-x86_64-grpc 1.35.0-5
mingw-w64-x86_64-harfbuzz 2.9.1-1
mingw-w64-x86_64-headers-git 9.0.0.6294.f5ac9206e-1
mingw-w64-x86_64-icu 69.1-1
mingw-w64-x86_64-isl 0.24-1
mingw-w64-x86_64-jansson 2.13.1-1
mingw-w64-x86_64-jasper 2.0.33-1
mingw-w64-x86_64-jbigkit 2.1-4
mingw-w64-x86_64-jemalloc 5.2.1-2
mingw-w64-x86_64-jsoncpp 1.9.4-1
mingw-w64-x86_64-lcms2 2.12-1
mingw-w64-x86_64-lerc 3.0-2
mingw-w64-x86_64-libarchive 3.5.2-1
mingw-w64-x86_64-libdeflate 1.8-2
mingw-w64-x86_64-libffi 3.3-4
mingw-w64-x86_64-libgccjit 10.3.0-5
mingw-w64-x86_64-libiconv 1.16-2
mingw-w64-x86_64-libidn2 2.3.1-1
mingw-w64-x86_64-libjpeg-turbo 2.1.1-1
mingw-w64-x86_64-libmangle-git 9.0.0.6294.f5ac9206e-1
mingw-w64-x86_64-libmng 2.0.3-4
mingw-w64-x86_64-libmysofa 1.2-1
mingw-w64-x86_64-libpng 1.6.37-6
mingw-w64-x86_64-libpsl 0.21.1-4
mingw-w64-x86_64-libssh2 1.10.0-1
mingw-w64-x86_64-libsystre 1.0.1-4
mingw-w64-x86_64-libtasn1 4.17.0-1
mingw-w64-x86_64-libtiff 4.3.0-6
mingw-w64-x86_64-libtre-git r128.6fb7206-2
mingw-w64-x86_64-libunistring 0.9.10-4
mingw-w64-x86_64-libuv 1.42.0-1
mingw-w64-x86_64-libwebp 1.2.1-1
mingw-w64-x86_64-libwinpthread-git 9.0.0.6294.f5ac9206e-1
mingw-w64-x86_64-libxml2 2.9.12-3
mingw-w64-x86_64-lld 12.0.1-5
mingw-w64-x86_64-llvm 12.0.1-5
mingw-w64-x86_64-lz4 1.9.3-1
mingw-w64-x86_64-make 4.3-1
mingw-w64-x86_64-md4c 0.4.8-1
mingw-w64-x86_64-minizip-git 1.2.445.e67b996-2
mingw-w64-x86_64-mpc 1.2.1-1
mingw-w64-x86_64-mpdecimal 2.5.1-1
mingw-w64-x86_64-mpfr 4.1.0.p13-1
mingw-w64-x86_64-nasm 2.15.05-1
mingw-w64-x86_64-ncurses 6.2-3
mingw-w64-x86_64-nettle 3.7.3-3
mingw-w64-x86_64-nghttp2 1.44.0-1
mingw-w64-x86_64-ninja 1.10.2-3
mingw-w64-x86_64-openal 1.21.1-2
mingw-w64-x86_64-openssl 1.1.1.l-1
mingw-w64-x86_64-p11-kit 0.24.0-1
mingw-w64-x86_64-pcre 8.45-1
mingw-w64-x86_64-pcre2 10.36-1
mingw-w64-x86_64-pkgconf 1.8.0-2
mingw-w64-x86_64-protobuf 3.16.0-3
mingw-w64-x86_64-python 3.9.6-4
mingw-w64-x86_64-qt5 5.15.2-15
mingw-w64-x86_64-qt5-3d 5.15.2+kde+r33-3
mingw-w64-x86_64-qt5-activeqt 5.15.2-3
mingw-w64-x86_64-qt5-base 5.15.2+kde+r96-1
mingw-w64-x86_64-qt5-charts 5.15.2+kde+r96-1
mingw-w64-x86_64-qt5-connectivity 5.15.2-3
mingw-w64-x86_64-qt5-datavis3d 5.15.2-3
mingw-w64-x86_64-qt5-declarative 5.15.2+kde+r96-1
mingw-w64-x86_64-qt5-gamepad 5.15.2-3
mingw-w64-x86_64-qt5-graphicaleffects 5.15.2-3
mingw-w64-x86_64-qt5-imageformats 5.15.2-4
mingw-w64-x86_64-qt5-location 5.15.2+kde+r96-1
mingw-w64-x86_64-qt5-lottie 5.15.2-3
mingw-w64-x86_64-qt5-multimedia 5.15.2-5
mingw-w64-x86_64-qt5-networkauth 5.15.2-3
mingw-w64-x86_64-qt5-purchasing 5.15.2-3
mingw-w64-x86_64-qt5-quick3d 5.15.2+kde+r96-1
mingw-w64-x86_64-qt5-quickcontrols 5.15.2-3
mingw-w64-x86_64-qt5-quickcontrols2 5.15.2-4
mingw-w64-x86_64-qt5-quicktimeline 5.15.2-3
mingw-w64-x86_64-qt5-remoteobjects 5.15.2-3
mingw-w64-x86_64-qt5-script 5.15.2+kde+r96-1
mingw-w64-x86_64-qt5-scxml 5.15.2-3
mingw-w64-x86_64-qt5-sensors 5.15.2-3
mingw-w64-x86_64-qt5-serialbus 5.15.2-3
mingw-w64-x86_64-qt5-serialport 5.15.2-3
mingw-w64-x86_64-qt5-speech 5.15.2-3
mingw-w64-x86_64-qt5-svg 5.15.2+kde+r7-3
mingw-w64-x86_64-qt5-tools 5.15.2+kde+r17-4
mingw-w64-x86_64-qt5-translations 5.15.2-3
mingw-w64-x86_64-qt5-virtualkeyboard 5.15.2-3
mingw-w64-x86_64-qt5-webchannel 5.15.2-3
mingw-w64-x86_64-qt5-webglplugin 5.15.2-3
mingw-w64-x86_64-qt5-websockets 5.15.2-3
mingw-w64-x86_64-qt5-webview 5.15.2-3
mingw-w64-x86_64-qt5-winextras 5.15.2-3
mingw-w64-x86_64-qt5-xmlpatterns 5.15.2-3
mingw-w64-x86_64-re2 20210901-1
mingw-w64-x86_64-readline 8.1.001-1
mingw-w64-x86_64-rhash 1.4.2-1
mingw-w64-x86_64-sqlite3 3.36.0-1
mingw-w64-x86_64-tcl 8.6.11-5
mingw-w64-x86_64-termcap 1.3.1-6
mingw-w64-x86_64-tk 8.6.11.1-2
mingw-w64-x86_64-tools-git 9.0.0.6294.f5ac9206e-1
mingw-w64-x86_64-vulkan-headers 1.2.179-2
mingw-w64-x86_64-vulkan-loader 1.2.179-2
mingw-w64-x86_64-windows-default-manifest 6.4-3
mingw-w64-x86_64-wineditline 2.205-3
mingw-w64-x86_64-winpthreads-git 9.0.0.6294.f5ac9206e-1
mingw-w64-x86_64-winstorecompat-git 9.0.0.6294.f5ac9206e-1
mingw-w64-x86_64-xxhash 0.8.0-1
mingw-w64-x86_64-xz 5.2.5-2
mingw-w64-x86_64-zlib 1.2.11-9
mingw-w64-x86_64-zstd 1.5.0-1
mintty 1~3.5.1-1
mpdecimal 2.5.0-1
mpfr 4.1.0-1
msys2-keyring 1~20210904-1
msys2-launcher 1.3-2
msys2-runtime 3.2.0-15
nano 5.8-1
ncurses 6.2-1
nettle 3.7.3-1
openssl 1.1.1.l-1
p11-kit 0.24.0-1
pacman 6.0.1-1
pacman-contrib 1.4.0-2
pacman-mirrors 20210902-1
patch 2.7.6-1
patchutils 0.4.2-2
pcre 8.45-1
pcre2 10.37-1
perl 5.32.1-1
perl-Locale-Gettext 1.07-7
perl-Module-Build 0.4231-1
perl-Test-Pod 1.52-1
perl-XML-Parser 2.46-3
perl-YAML-Syck 1.34-1
perl-inc-latest 0.500-1
pinentry 1.1.1-1
pkgconf 1.8.0-1
pkgfile 21-1
python 3.9.6-1
quilt 0.66-2
rebase 4.5.0-1
reflex 20210510-1
scons 3.1.2-6
sed 4.8-1
swig 4.0.2-1
tar 1.34-1
tcl 8.6.10-1
texinfo 6.8-1
texinfo-tex 6.8-1
tftp-hpa 5.2-3
time 1.9-1
ttyrec 1.0.8-2
tzcode 2021a-1
unrar 6.0.7-1
util-linux 2.35.2-1
wget 1.21.2-1
which 2.21-2
xmlto 0.0.28-2
xxhash 0.8.0-1
xz 5.2.5-1
zlib 1.2.11-1
zstd 1.5.0-1
我做错了什么?
编辑:
在示例代码的循环中添加了一条 sleep 语句,以解决注释的注意事项。
Same question here:
Memory leaks using shared_mutex
but in Windows 11.
The Windows handles are not being closed.
#include <iostream>
using namespace std;
#include <shared_mutex>
extern "C" {
#include <processthreadsapi.h>
}
int GetHandleCount() {
HANDLE processHandle = GetCurrentProcess();
unsigned long hCount = 0;
WINBOOL valid = GetProcessHandleCount(processHandle, &hCount);
if (valid) {
return hCount;
}
return -1;
}
class foo {
public:
void bar() {
std::unique_lock lock(m_mtx);
}
std::shared_mutex m_mtx;
};
int main() {
cout << "Handles to start with=" << GetHandleCount() << std::endl;
for (int i = 0; i < 1000; i++) {
foo obj;
obj.bar();
std::this_thread::sleep_for(std::chrono::milliseconds{1}); // added this line to address Mgetz' comment
}
cout << "Handles when finished=" << GetHandleCount() << std::endl;
}
The output is:
Handles to start with=45
Handles when finished=2045
Windows Task-Manager shows rapidly increasing number of
handles.
compiled with:
g++ -std=c++17 -O0 -g3 -Wall -c -fmessage-length=0 -o "src\\Testumgebung.o" "..\\src\\Testumgebung.cpp"
g++ -o Testumgebung.exe "src\\Testumgebung.o" -liphlpapi
I'm using msys2 environment with following packages installed:
$ pacman -Q
asciidoc 9.1.0-2
autoconf 2.71-1
autoconf2.13 2.13-3
autogen 5.18.16-1
automake-wrapper 11-1
automake1.10 1.10.3-4
automake1.11 1.11.6-4
automake1.12 1.12.6-4
automake1.13 1.13.4-5
automake1.14 1.14.1-4
automake1.15 1.15.1-2
automake1.16 1.16.3-1
automake1.6 1.6.3-3
automake1.7 1.7.9-3
automake1.8 1.8.5-4
automake1.9 1.9.6-3
base 2020.12-1
bash 5.1.008-1
bash-completion 2.11-1
bison 3.8.1-1
brotli 1.0.9-2
bsdtar 3.5.2-1
btyacc 20210619-1
bzip2 1.0.8-2
ca-certificates 20210119-2
ccache 4.4-1
cmake 3.21.2-1
coreutils 8.32-1
curl 7.79.0-1
dash 0.5.11.4-1
db 5.3.28-3
diffstat 1.64-1
diffutils 3.8-1
docbook-xml 4.5-2
docbook-xsl 1.79.2-1
dos2unix 7.4.2-1
expat 2.4.1-1
file 5.40-2
filesystem 2021.06-1
findutils 4.8.0-1
flex 2.6.4-1
gawk 5.1.0-1
gcc-libs 10.2.0-1
gdb 10.2-3
gdbm 1.21-1
getent 2.18.90-2
gettext 0.19.8.1-1
gettext-devel 0.19.8.1-1
glib2 2.68.4-1
gmp 6.2.1-1
gnupg 2.2.29-1
gperf 3.1-2
grep 3.6-1
groff 1.22.4-1
gzip 1.11-1
heimdal-libs 7.7.0-2
help2man 1.48.5-1
icu 69.1-1
inetutils 1.9.4-2
info 6.8-1
intltool 0.51.0-2
jsoncpp 1.9.4-1
less 590-1
libarchive 3.5.2-1
libargp 20110921-2
libasprintf 0.19.8.1-1
libassuan 2.5.5-1
libatomic_ops 7.6.10-1
libbz2 1.0.8-2
libcrypt 2.1-3
libcurl 7.79.0-1
libdb 5.3.28-3
libedit 20210714_3.1-1
libexpat 2.4.1-1
libffi 3.3-1
libgc 8.0.4-1
libgcrypt 1.9.4-1
libgdbm 1.21-1
libgettextpo 0.19.8.1-1
libgnutls 3.7.2-1
libgpg-error 1.42-1
libgpgme 1.16.0-1
libguile 2.2.7-1
libhogweed 3.7.3-1
libiconv 1.16-2
libiconv-devel 1.16-2
libidn2 2.3.2-1
libintl 0.19.8.1-1
libksba 1.6.0-1
libltdl 2.4.6-11
liblz4 1.9.3-1
liblzma 5.2.5-1
libmetalink 0.1.3-3
libnettle 3.7.3-1
libnghttp2 1.44.0-1
libnpth 1.6-1
libopenssl 1.1.1.l-1
libp11-kit 0.24.0-1
libpcre 8.45-1
libpcre16 8.45-1
libpcre2_16 10.37-1
libpcre2_32 10.37-1
libpcre2_8 10.37-1
libpcre2posix 10.37-1
libpcre32 8.45-1
libpcrecpp 8.45-1
libpcreposix 8.45-1
libpipeline 1.5.3-2
libpsl 0.21.1-2
libreadline 8.1.001-1
librhash 1.4.2-1
libsqlite 3.36.0-2
libssh2 1.10.0-1
libtasn1 4.17.0-2
libtool 2.4.6-11
libunistring 0.9.10-1
libunrar 6.0.7-1
libunrar-devel 6.0.7-1
libutil-linux 2.35.2-1
libuv 1.42.0-1
libxml2 2.9.12-2
libxslt 1.1.34-4
libxxhash 0.8.0-1
libzstd 1.5.0-1
lld 11.0.0-4
llvm 11.0.0-4
m4 1.4.19-1
make 4.3-1
man-db 2.9.4-1
mingw-w64-i686-binutils 2.37-4
mingw-w64-i686-crt-git 9.0.0.6294.f5ac9206e-1
mingw-w64-i686-gcc 10.3.0-5
mingw-w64-i686-gcc-libs 10.3.0-5
mingw-w64-i686-gmp 6.2.1-2
mingw-w64-i686-headers-git 9.0.0.6294.f5ac9206e-1
mingw-w64-i686-isl 0.24-1
mingw-w64-i686-libiconv 1.16-2
mingw-w64-i686-libwinpthread-git 9.0.0.6294.f5ac9206e-1
mingw-w64-i686-mpc 1.2.1-1
mingw-w64-i686-mpfr 4.1.0.p13-1
mingw-w64-i686-windows-default-manifest 6.4-3
mingw-w64-i686-winpthreads-git 9.0.0.6294.f5ac9206e-1
mingw-w64-i686-zlib 1.2.11-9
mingw-w64-i686-zstd 1.5.0-1
mingw-w64-x86_64-assimp 5.0.1-11
mingw-w64-x86_64-binutils 2.37-4
mingw-w64-x86_64-boost 1.77.0-1
mingw-w64-x86_64-brotli 1.0.9-3
mingw-w64-x86_64-bzip2 1.0.8-2
mingw-w64-x86_64-c-ares 1.17.2-1
mingw-w64-x86_64-ca-certificates 20200601-3
mingw-w64-x86_64-cmake 3.21.2-1
mingw-w64-x86_64-crt-git 9.0.0.6294.f5ac9206e-1
mingw-w64-x86_64-curl 7.79.0-1
mingw-w64-x86_64-dbus 1.12.20-3
mingw-w64-x86_64-double-conversion 3.1.5-1
mingw-w64-x86_64-expat 2.4.1-1
mingw-w64-x86_64-fontconfig 2.13.94-1
mingw-w64-x86_64-freeglut 3.2.1-2
mingw-w64-x86_64-freetype 2.11.0-2
mingw-w64-x86_64-gcc 10.3.0-5
mingw-w64-x86_64-gcc-ada 10.3.0-5
mingw-w64-x86_64-gcc-fortran 10.3.0-5
mingw-w64-x86_64-gcc-libgfortran 10.3.0-5
mingw-w64-x86_64-gcc-libs 10.3.0-5
mingw-w64-x86_64-gcc-objc 10.3.0-5
mingw-w64-x86_64-gdb 10.2-2
mingw-w64-x86_64-gdb-multiarch 10.2-2
mingw-w64-x86_64-gettext 0.19.8.1-10
mingw-w64-x86_64-gflags 2.2.2-2
mingw-w64-x86_64-giflib 5.2.1-3
mingw-w64-x86_64-glib2 2.70.0-1
mingw-w64-x86_64-gmp 6.2.1-2
mingw-w64-x86_64-graphite2 1.3.14-2
mingw-w64-x86_64-grpc 1.35.0-5
mingw-w64-x86_64-harfbuzz 2.9.1-1
mingw-w64-x86_64-headers-git 9.0.0.6294.f5ac9206e-1
mingw-w64-x86_64-icu 69.1-1
mingw-w64-x86_64-isl 0.24-1
mingw-w64-x86_64-jansson 2.13.1-1
mingw-w64-x86_64-jasper 2.0.33-1
mingw-w64-x86_64-jbigkit 2.1-4
mingw-w64-x86_64-jemalloc 5.2.1-2
mingw-w64-x86_64-jsoncpp 1.9.4-1
mingw-w64-x86_64-lcms2 2.12-1
mingw-w64-x86_64-lerc 3.0-2
mingw-w64-x86_64-libarchive 3.5.2-1
mingw-w64-x86_64-libdeflate 1.8-2
mingw-w64-x86_64-libffi 3.3-4
mingw-w64-x86_64-libgccjit 10.3.0-5
mingw-w64-x86_64-libiconv 1.16-2
mingw-w64-x86_64-libidn2 2.3.1-1
mingw-w64-x86_64-libjpeg-turbo 2.1.1-1
mingw-w64-x86_64-libmangle-git 9.0.0.6294.f5ac9206e-1
mingw-w64-x86_64-libmng 2.0.3-4
mingw-w64-x86_64-libmysofa 1.2-1
mingw-w64-x86_64-libpng 1.6.37-6
mingw-w64-x86_64-libpsl 0.21.1-4
mingw-w64-x86_64-libssh2 1.10.0-1
mingw-w64-x86_64-libsystre 1.0.1-4
mingw-w64-x86_64-libtasn1 4.17.0-1
mingw-w64-x86_64-libtiff 4.3.0-6
mingw-w64-x86_64-libtre-git r128.6fb7206-2
mingw-w64-x86_64-libunistring 0.9.10-4
mingw-w64-x86_64-libuv 1.42.0-1
mingw-w64-x86_64-libwebp 1.2.1-1
mingw-w64-x86_64-libwinpthread-git 9.0.0.6294.f5ac9206e-1
mingw-w64-x86_64-libxml2 2.9.12-3
mingw-w64-x86_64-lld 12.0.1-5
mingw-w64-x86_64-llvm 12.0.1-5
mingw-w64-x86_64-lz4 1.9.3-1
mingw-w64-x86_64-make 4.3-1
mingw-w64-x86_64-md4c 0.4.8-1
mingw-w64-x86_64-minizip-git 1.2.445.e67b996-2
mingw-w64-x86_64-mpc 1.2.1-1
mingw-w64-x86_64-mpdecimal 2.5.1-1
mingw-w64-x86_64-mpfr 4.1.0.p13-1
mingw-w64-x86_64-nasm 2.15.05-1
mingw-w64-x86_64-ncurses 6.2-3
mingw-w64-x86_64-nettle 3.7.3-3
mingw-w64-x86_64-nghttp2 1.44.0-1
mingw-w64-x86_64-ninja 1.10.2-3
mingw-w64-x86_64-openal 1.21.1-2
mingw-w64-x86_64-openssl 1.1.1.l-1
mingw-w64-x86_64-p11-kit 0.24.0-1
mingw-w64-x86_64-pcre 8.45-1
mingw-w64-x86_64-pcre2 10.36-1
mingw-w64-x86_64-pkgconf 1.8.0-2
mingw-w64-x86_64-protobuf 3.16.0-3
mingw-w64-x86_64-python 3.9.6-4
mingw-w64-x86_64-qt5 5.15.2-15
mingw-w64-x86_64-qt5-3d 5.15.2+kde+r33-3
mingw-w64-x86_64-qt5-activeqt 5.15.2-3
mingw-w64-x86_64-qt5-base 5.15.2+kde+r96-1
mingw-w64-x86_64-qt5-charts 5.15.2+kde+r96-1
mingw-w64-x86_64-qt5-connectivity 5.15.2-3
mingw-w64-x86_64-qt5-datavis3d 5.15.2-3
mingw-w64-x86_64-qt5-declarative 5.15.2+kde+r96-1
mingw-w64-x86_64-qt5-gamepad 5.15.2-3
mingw-w64-x86_64-qt5-graphicaleffects 5.15.2-3
mingw-w64-x86_64-qt5-imageformats 5.15.2-4
mingw-w64-x86_64-qt5-location 5.15.2+kde+r96-1
mingw-w64-x86_64-qt5-lottie 5.15.2-3
mingw-w64-x86_64-qt5-multimedia 5.15.2-5
mingw-w64-x86_64-qt5-networkauth 5.15.2-3
mingw-w64-x86_64-qt5-purchasing 5.15.2-3
mingw-w64-x86_64-qt5-quick3d 5.15.2+kde+r96-1
mingw-w64-x86_64-qt5-quickcontrols 5.15.2-3
mingw-w64-x86_64-qt5-quickcontrols2 5.15.2-4
mingw-w64-x86_64-qt5-quicktimeline 5.15.2-3
mingw-w64-x86_64-qt5-remoteobjects 5.15.2-3
mingw-w64-x86_64-qt5-script 5.15.2+kde+r96-1
mingw-w64-x86_64-qt5-scxml 5.15.2-3
mingw-w64-x86_64-qt5-sensors 5.15.2-3
mingw-w64-x86_64-qt5-serialbus 5.15.2-3
mingw-w64-x86_64-qt5-serialport 5.15.2-3
mingw-w64-x86_64-qt5-speech 5.15.2-3
mingw-w64-x86_64-qt5-svg 5.15.2+kde+r7-3
mingw-w64-x86_64-qt5-tools 5.15.2+kde+r17-4
mingw-w64-x86_64-qt5-translations 5.15.2-3
mingw-w64-x86_64-qt5-virtualkeyboard 5.15.2-3
mingw-w64-x86_64-qt5-webchannel 5.15.2-3
mingw-w64-x86_64-qt5-webglplugin 5.15.2-3
mingw-w64-x86_64-qt5-websockets 5.15.2-3
mingw-w64-x86_64-qt5-webview 5.15.2-3
mingw-w64-x86_64-qt5-winextras 5.15.2-3
mingw-w64-x86_64-qt5-xmlpatterns 5.15.2-3
mingw-w64-x86_64-re2 20210901-1
mingw-w64-x86_64-readline 8.1.001-1
mingw-w64-x86_64-rhash 1.4.2-1
mingw-w64-x86_64-sqlite3 3.36.0-1
mingw-w64-x86_64-tcl 8.6.11-5
mingw-w64-x86_64-termcap 1.3.1-6
mingw-w64-x86_64-tk 8.6.11.1-2
mingw-w64-x86_64-tools-git 9.0.0.6294.f5ac9206e-1
mingw-w64-x86_64-vulkan-headers 1.2.179-2
mingw-w64-x86_64-vulkan-loader 1.2.179-2
mingw-w64-x86_64-windows-default-manifest 6.4-3
mingw-w64-x86_64-wineditline 2.205-3
mingw-w64-x86_64-winpthreads-git 9.0.0.6294.f5ac9206e-1
mingw-w64-x86_64-winstorecompat-git 9.0.0.6294.f5ac9206e-1
mingw-w64-x86_64-xxhash 0.8.0-1
mingw-w64-x86_64-xz 5.2.5-2
mingw-w64-x86_64-zlib 1.2.11-9
mingw-w64-x86_64-zstd 1.5.0-1
mintty 1~3.5.1-1
mpdecimal 2.5.0-1
mpfr 4.1.0-1
msys2-keyring 1~20210904-1
msys2-launcher 1.3-2
msys2-runtime 3.2.0-15
nano 5.8-1
ncurses 6.2-1
nettle 3.7.3-1
openssl 1.1.1.l-1
p11-kit 0.24.0-1
pacman 6.0.1-1
pacman-contrib 1.4.0-2
pacman-mirrors 20210902-1
patch 2.7.6-1
patchutils 0.4.2-2
pcre 8.45-1
pcre2 10.37-1
perl 5.32.1-1
perl-Locale-Gettext 1.07-7
perl-Module-Build 0.4231-1
perl-Test-Pod 1.52-1
perl-XML-Parser 2.46-3
perl-YAML-Syck 1.34-1
perl-inc-latest 0.500-1
pinentry 1.1.1-1
pkgconf 1.8.0-1
pkgfile 21-1
python 3.9.6-1
quilt 0.66-2
rebase 4.5.0-1
reflex 20210510-1
scons 3.1.2-6
sed 4.8-1
swig 4.0.2-1
tar 1.34-1
tcl 8.6.10-1
texinfo 6.8-1
texinfo-tex 6.8-1
tftp-hpa 5.2-3
time 1.9-1
ttyrec 1.0.8-2
tzcode 2021a-1
unrar 6.0.7-1
util-linux 2.35.2-1
wget 1.21.2-1
which 2.21-2
xmlto 0.0.28-2
xxhash 0.8.0-1
xz 5.2.5-1
zlib 1.2.11-1
zstd 1.5.0-1
What am I doing wrong?
Edit:
Added a sleep statement in the loop of the example code to address the considerations of the comments.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论