I would like to increase the number of threads on my video coded application with the help of threadpool functions. Here is what I have done until now. The problem is that I am unable to compile it.
Code:
#include<windows.h>
#include<stdio.h>
#include<conio.h>
#define THREAD_SIZE 6
DWORD WINAPI lprint(LPVOID p);
struct node
{
int p,q;
};
typedef struct node* NODEPTR;
void main()
{
NODEPTR ptr[THREAD_SIZE];
DWORD th[THREAD_SIZE];
BOOL hth[THREAD_SIZE];
int i;
for(i=0;i<THREAD_SIZE;i++)
{
ptr[i]=(NODEPTR)malloc(sizeof(NODEPTR));
ptr[i]->p=i;
ptr[i]->q=i*1000;
//hth[i]=CreateThread(NULL,0,lprint,ptr[i],0,&th[i]);
hth[i]=QueueUserWorkItem(lprint,ptr[i],WT_EXECUTEDEFAULT);
//WT_EXECUTEINIOTHREAD
}
WaitForMultipleObjects(THREAD_SIZE, hth , TRUE, INFINITE);
for(i=0;i<THREAD_SIZE;i++)
{
CloseHandle(hth[i]);
}
getch();
}
DWORD WINAPI lprint(LPVOID l)
{
NODEPTR s1=(NODEPTR) l;
printf("%d %d\n",s1->p,s1->q);
return 0;
}
It gives me an error message which states "error C3861: 'QueueUserWorkItem': identifier not found. Is there someone who can explain me this and provide a solution to it?
Bookmarks