mirror of
https://github.com/PurpleI2P/i2pd-tools.git
synced 2025-01-22 21:37:18 +01:00
commit
548391acfe
24
vanity.hpp
24
vanity.hpp
|
@ -10,9 +10,12 @@
|
|||
#include <unistd.h>
|
||||
#include <vector>
|
||||
#include <mutex>
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
// MARCO
|
||||
#ifndef _WIN32
|
||||
#define INIT_CPUS(count_cpu){\
|
||||
cpu = CPU_ALLOC(count_cpu-1);\
|
||||
if (cpu == NULL) {\
|
||||
|
@ -20,9 +23,18 @@ std::cout << "CPU_ALLOC error" << std::endl;\
|
|||
return 1;\
|
||||
}\
|
||||
}
|
||||
|
||||
|
||||
|
||||
#else
|
||||
#warning don't testing
|
||||
#define INIT_CPUS(count_cpu){\
|
||||
HANDLE process;\
|
||||
DWORD_PTR processAffinityMask;\
|
||||
for(int i=0; i<count_cpu; i++) processAffinityMask |= 1<<(2*i);\
|
||||
process = GetCurrentProcess();\
|
||||
HANDLE thread = GetCurrentThread();\
|
||||
DWORD_PTR threadAffinityMask = 1<<(2*omp_get_thread_num());\
|
||||
SetThreadAffinityMask(thread, threadAffinityMask);\
|
||||
}
|
||||
#endif
|
||||
|
||||
static std::mutex thread_mutex;
|
||||
static i2p::data::SigningKeyType type;
|
||||
|
@ -32,8 +44,9 @@ static size_t padding_size;
|
|||
static uint8_t * KeyBuf;
|
||||
static uint8_t * PaddingBuf;
|
||||
static unsigned long long hash;
|
||||
#ifndef _WIN32
|
||||
static cpu_set_t * cpu;
|
||||
|
||||
#endif
|
||||
//Functions visible and don't need.
|
||||
|
||||
|
||||
|
@ -46,3 +59,4 @@ namespace vain{
|
|||
}
|
||||
}
|
||||
*/
|
||||
|
||||
|
|
|
@ -53,10 +53,10 @@ static inline void mutate_keys_cpu(
|
|||
|
||||
static void thread_find(const char * prefix,int id_thread){
|
||||
|
||||
|
||||
#ifndef _WIN32
|
||||
sched_setaffinity(0, sizeof(cpu), cpu);
|
||||
cpu++;
|
||||
|
||||
#endif
|
||||
std::cout << "Thread " << id_thread << " binded" << std::endl;
|
||||
|
||||
while(NotThat(keys.GetPublic()->GetIdentHash().ToBase32().c_str(),prefix) and !finded)
|
||||
|
@ -171,3 +171,4 @@ TODO:
|
|||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue