Let me just say that this is inconvenient. Looping into a variable is probably faster done in a single thread, than to create four threads and to wait for them all to begin and end. Because you will HAVE to wait for a thread's begin, and to wait for a thread's end.
The buffer is quite large and this process is being done a massive amount of times, processing in excess of 500gb of data.
The idea being that 4 threads simultaneously processing their section buffer is quicker was based on a multi-core system and the fact the program is currently maxing out a single core of the processor.
Much as I realise I will have to wait for all 4 threads to end, it still seems this might be quicker.
Sorry. So that was a good reason, just think about a thing: You will not be able to load 500gb of data into ram.
Anyways, you should have something like CreateThread or _beginthread (process.h) to begin a thread, prepare a struct of "common data" between threads and send the pointer as a LPVOID (void *) when beginning the thread, and once the first thread ended, call WaitForSingleObject for each Thread Handle that has been returned from CreateThread/_beginthread or WaitForMultipleObjects for a Thread Handle Array.
webjose: As I already have to code for working in a single thread, I was trying to figure how to take this and insert it into a threads, taking additional parameters to define the start and end points for each thread.
So basically so I could create the threads using a quarter of the buffer so
thread1(0,bufffersize/4)
thread2(bufffersize/4, bufffersize/2)
thread3(bufffersize/2, bufffersize/ 4 * 3)
thread4(bufffersize/4 * 3, bufffersize)
Looking for how I would write the thread structure.
The buffer is only read and never written to so it should be ok to access from all threads rather than creating a copy right?