I'm setting this to needs triage as I'm not sure how important you think threading issues are. It is my opinion that as long as we don't hit system limits like max fd's or max memory the whole GnuPG System ( all components + GPGME ) should be able to handle parallel loads. And 10 operations is quite little. I can see Kleopatra starting 10 decrypts easily.
In this issue "gcrypt's Cannot allocate memory", if it is that limited the error should be handled internally or the number of currently running connections (not accepted connections) be limited.
To reproduce for me:
export GNUPGHOME=$(mktemp -d) gpg --yes --pinentry-mode loopback --passphrase "test" --quick-gen-key email@example.com echo Hello | gpg -er firstname.lastname@example.org > $GNUPGHOME/pgp-enc # unlock the key gpg --pinentry-mode loopback --passphrase "test" -d $GNUPGHOME/pgp-enc ./run-threaded --no-list --threads 10 --data-type 3 --repeat 10 $GNUPGHOME/pgp-enc
When I change the key to future-default it works for me.