Making visual cpp program use dual core?

How do you make a visual cpp project run using duel cores? I looked at the affinity in the control panel, and it is set to use both cores, but the cpu meter only shows one core maxing out when I run a cpu-intensive section (calculating primes).
I could have no idea what I'm talking about, but I think 1 thread can only execute on one core at a time.
Yeah, sorry... after a bit of research, what I meant was how do you create a multi-threaded application?

HANDLE WINAPI CreateThread(
__in LPSECURITY_ATTRIBUTES lpThreadAttributes,
__in SIZE_T dwStackSize,
__in LPTHREAD_START_ROUTINE lpStartAddress,
__in LPVOID lpParameter,
__in DWORD dwCreationFlags,
__out LPDWORD lpThreadId
);


Since you're using VC++, you might want to consider using OpenMP directives.

Here's a nice article on the subject: http://msdn.microsoft.com/en-us/magazine/cc163717.aspx
Topic archived. No new replies allowed.