- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am trying to multi thread my video coded application using threadpool functions.I am trying small examples with these functions. But i could not compile when i use those functions can some body help me tegarding this..
#include
#include
#include
#define MAX_THREADS 6
DWORD WINAPI lprint(LPVOID p);
struct node
{
int a,b;
};
typedef struct node* NODEPTR;
void main()
{
NODEPTR ptr[MAX_THREADS];
DWORD th[MAX_THREADS];
BOOL hth[MAX_THREADS];
int i;
for(i=0;i
{
ptr=(NODEPTR)malloc(sizeof(NODEPTR));
ptr->a=i;
ptr->b=i*1000;
//hth=CreateThread(NULL,0,lprint,ptr,0,&th);
hth=QueueUserWorkItem(lprint,ptr,WT_EXECUTEDEFAULT);
//WT_EXECUTEINIOTHREAD
}
WaitForMultipleObjects(MAX_THREADS, hth , TRUE, INFINITE);
for(i=0;i
{
CloseHandle(hth);
}
getch();
}
DWORD WINAPI lprint(LPVOID p)
{
NODEPTR s1=(NODEPTR) p;
printf("%d %d\\n",s1->a,s1->b);
return 0;
}
Link Copied
6 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Do you define _WIN32_WINNT as at least 0x0500?
What error do you get?
What error do you get?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
error C3861: 'QueueUserWorkItem': identifier not found
even after defining i got this above error.
i have included only windows.h ,do i need to include other header files,and my code is in C,can i use this function in C code?
pls reply..
thanks in advance
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Don't you use MS Visual Studio 2003? It looks like you have substantially outdated Platform SDK...
Do you have definition of QueueUserWorkItem() in winbase.h?
Do you have definition of QueueUserWorkItem() in winbase.h?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I m using visual studio 2008.
I have definition of QueueUserWorkItem() in winbase.h(include dir of platform SDK)
should i use MS VS 2003? cant i use 2008?
how to update the new platformSDK?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Humm... well, the following program compiles and links successfully on my MSVC2008
// main.c
#include "windows.h"
DWORD CALLBACK func(void* p)
{
return 0;
}
int main()
{
QueueUserWorkItem(func, 0, 0);
return 0;
}
// main.c
#include "windows.h"
DWORD CALLBACK func(void* p)
{
return 0;
}
int main()
{
QueueUserWorkItem(func, 0, 0);
return 0;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
i have included platformSDK include folder,which have WInBase.h,and Queuserworkitem is defined in it.still the same error in my project..im using older version of platform sdk..is this the reason..or do i have to include any extra directories?
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page