fixed some stuff
This commit is contained in:
parent
5671ca3c1c
commit
efac07862c
@ -2,7 +2,7 @@
|
||||
#ifdef NO_OPEN_SSL
|
||||
#include <tomcrypt.h>
|
||||
|
||||
#define DECLARE_DIGEST(name, _unused_, digestLength) \
|
||||
#define DECLARE_DIGEST(name, digestLength) \
|
||||
void digest::tomcrypt::name(const char* input, size_t length, uint8_t* result) { \
|
||||
hash_state hash{}; \
|
||||
\
|
||||
@ -11,7 +11,7 @@
|
||||
name ##_done(&hash, result); \
|
||||
}
|
||||
|
||||
DECLARE_DIGEST(sha1, SHA1, SHA_DIGEST_LENGTH)
|
||||
DECLARE_DIGEST(sha256, SHA256, SHA256_DIGEST_LENGTH)
|
||||
DECLARE_DIGEST(sha512, SHA512, SHA512_DIGEST_LENGTH)
|
||||
DECLARE_DIGEST(sha1, SHA_DIGEST_LENGTH)
|
||||
DECLARE_DIGEST(sha256, SHA256_DIGEST_LENGTH)
|
||||
DECLARE_DIGEST(sha512, SHA512_DIGEST_LENGTH)
|
||||
#endif
|
||||
|
@ -9,17 +9,21 @@ class spin_lock {
|
||||
inline void lock() {
|
||||
uint8_t round = 0;
|
||||
while (locked.test_and_set(std::memory_order_acquire)) {
|
||||
#if false
|
||||
/* waiting 'till its zero so we can try an exchanged again; Atomic exchanges have a huge bug overhead to deal with! */
|
||||
#ifdef WIN32
|
||||
while(locked._My_flag > 0) {
|
||||
#else
|
||||
while(locked._M_i) {
|
||||
#endif
|
||||
#endif
|
||||
//Yield when we're using this lock for a longer time, which we usually not doing
|
||||
if(round++ % 8 == 0)
|
||||
std::this_thread::yield();
|
||||
#if false
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
inline bool try_lock() {
|
||||
|
Loading…
Reference in New Issue
Block a user