What to replace the pthread.h (Linux) with on VS 2022 & CUDA Toolkit

I am trying to modify Linux program to Visual Studio 2022 & CUDA Toolkit. What to replace the Linux pthread.h commands with to be able to compile the program?

These are the commands:

pthread_mutex_init()
pthread_mutex_lock()
pthread_create()
pthread_mutex_unlock()

Part of the main program:

    pthread_mutex_init(&solutionLock, NULL);
    pthread_mutex_lock(&solutionLock);

    unsigned long** processedPtrs = (unsigned long**)malloc(sizeof(unsigned long*) * GPUS);
    pthread_t* tids = (pthread_t*)malloc(sizeof(pthread_t) * GPUS);
    long long start = timems();
    for (int i = 0; i < GPUS; i++) {
        HandlerInput* hi = (HandlerInput*)malloc(sizeof(HandlerInput));
        hi->device = i;
        hi->hashesProcessed = 0;
        processedPtrs[i] = &hi->hashesProcessed;
        pthread_create(tids + i, NULL, launchGPUHandlerThread, hi);
        usleep(10);
    }

If you need to use winapi, there is createthread Creating Threads - Win32 apps | Microsoft Learn .
If you develop a modern c++ application, you could rewrite the code using c++ threads and friends.

You could also setup wsl2 with CUDA and run the program without modifications.

I would also recommend you use C++ 's language support for concurrent / multi-thread programming.

Try this gentle introduction video from the CppCon 2021 conference to concurrent programming with C++.

That’s interesting. Thank you. I will have a look on it.