wownero/src/crypto
SChernykh c742fa4c6e Fixed deadlock and crash when syncing with full dataset on Windows
It's not allowed to use WaitForSingleObject with _beginthread, because the thread closes its own handle before exiting.

So the wait function will either wait on an invalid handle, or on a different handle used by something else.

Or, if it starts waiting before the thread exits, the behavior is undefined according to MS: "If this handle is closed while the wait is still pending, the function's behavior is undefined."

In my test sync I observed threads getting stuck infinitely on WaitForSingleObject, and then rx_set_main_seedhash spamming new threads when RandomX seed changes again. Eventually the system ran out of resources, and monerod aborted with "Couldn't start RandomX seed thread" message.

This PR fixes it by using `_beginthreadex` instead and explicitly closing the handle when it's safe.
2023-03-29 08:44:20 +02:00
..
crypto_ops_builder Copyright: Update to 2022 2022-03-04 06:59:20 +01:00
wallet Copyright: Update to 2022 2022-03-04 06:59:20 +01:00
aesb.c aesb: avoid stomping on an existing define on NetBSD 2019-03-07 16:08:00 +00:00
blake256.c Copyright: Update to 2022 2022-03-04 06:59:20 +01:00
blake256.h Copyright: Update to 2022 2022-03-04 06:59:20 +01:00
c_threads.h Fixed deadlock and crash when syncing with full dataset on Windows 2023-03-29 08:44:20 +02:00
chacha.c move int-util.h to epee 2018-12-04 15:14:29 +00:00
chacha.h Copyright: Update to 2022 2022-03-04 06:59:20 +01:00
CMakeLists.txt CMake: Add missing headers via monero_find_all_headers macro 2022-04-06 08:12:44 +02:00
crypto-ops-data.c Copyright: Update to 2022 2022-03-04 06:59:20 +01:00
crypto-ops.c Copyright: Update to 2022 2022-03-04 06:59:20 +01:00
crypto-ops.h Copyright: Update to 2022 2022-03-04 06:59:20 +01:00
crypto.cpp Add view tags to outputs to reduce wallet scanning time 2022-04-18 00:49:53 -07:00
crypto.h Add view tags to outputs to reduce wallet scanning time 2022-04-18 00:49:53 -07:00
CryptonightR_JIT.c CryptonightR_JIT: fix return value on error 2019-07-04 12:49:54 +01:00
CryptonightR_JIT.h slow-hash: fix build on arm 2019-03-05 10:24:24 +00:00
CryptonightR_template.h CryptonightR: define out i386/x86_64 specific code on other archs 2019-03-05 10:24:24 +00:00
CryptonightR_template.S CNv4 JIT compiler for x86-64 and tests 2019-03-04 11:56:29 +00:00
duration.h Copyright: Update to 2022 2022-03-04 06:59:20 +01:00
generic-ops.h Copyright: Update to 2022 2022-03-04 06:59:20 +01:00
groestl.c crypto: fixed groestl on big-endian platforms 2018-10-25 02:06:23 +00:00
groestl.h Copyright: Update to 2022 2022-03-04 06:59:20 +01:00
groestl_tables.h Copyright: Update to 2022 2022-03-04 06:59:20 +01:00
hash-extra-blake.c Copyright: Update to 2022 2022-03-04 06:59:20 +01:00
hash-extra-groestl.c Copyright: Update to 2022 2022-03-04 06:59:20 +01:00
hash-extra-jh.c Copyright: Update to 2022 2022-03-04 06:59:20 +01:00
hash-extra-skein.c Copyright: Update to 2022 2022-03-04 06:59:20 +01:00
hash-ops.h Refactored rx-slow-hash.c 2022-12-14 07:21:00 +01:00
hash.c Copyright: Update to 2022 2022-03-04 06:59:20 +01:00
hash.h Copyright: Update to 2022 2022-03-04 06:59:20 +01:00
hmac-keccak.c Copyright: Update to 2022 2022-03-04 06:59:20 +01:00
hmac-keccak.h Copyright: Update to 2022 2022-03-04 06:59:20 +01:00
initializer.h Copyright: Update to 2022 2022-03-04 06:59:20 +01:00
jh.c moved all stuff to github 2014-03-03 22:07:58 +00:00
jh.h moved all stuff to github 2014-03-03 22:07:58 +00:00
keccak.c Optimized keccak implementation 2022-04-18 10:01:13 +02:00
keccak.h Incremental Keccak API added 2018-08-15 18:20:22 +02:00
oaes_config.h Update oaes_config.h 2014-05-17 15:39:46 -07:00
oaes_lib.c NetBSD support 2018-09-11 14:32:33 +00:00
oaes_lib.h 0.8.8update 2014-05-25 13:06:40 -04:00
random.c Copyright: Update to 2022 2022-03-04 06:59:20 +01:00
random.h Copyright: Update to 2022 2022-03-04 06:59:20 +01:00
rx-slow-hash.c Fixed deadlock and crash when syncing with full dataset on Windows 2023-03-29 08:44:20 +02:00
skein.c Changed to ..._HASHBITS everywhere for consistency 2016-10-29 14:59:06 +01:00
skein.h moved all stuff to github 2014-03-03 22:07:58 +00:00
skein_port.h Copyright: Update to 2022 2022-03-04 06:59:20 +01:00
slow-hash.c Copyright: Update to 2022 2022-03-04 06:59:20 +01:00
tree-hash.c Copyright: Update to 2022 2022-03-04 06:59:20 +01:00
variant2_int_sqrt.h Cryptonight variant 2 2018-09-09 20:43:01 +02:00
variant4_random_math.h Adding cnv4-2 tweaks 2019-02-14 20:42:50 +01:00