Thread in driver
- From: winstonhyypia@xxxxxxxxx
- Date: Thu, 10 Apr 2008 22:40:57 -0700 (PDT)
Actually I would like to create a driver which I can pass a function
pointer in. And the driver is able to do the callback whenever there
is an interrupt. Here is my program...
File Driver_Main.c
void SomeISTThread()
{
while (TRUE)
{
/* Wait for the application event to be released */
WaitForSingleObject(Somevent, INFINITE);
Callback();
InterruptDone(SomeIntr);
}
}
BOOL WINAPI DllEntry(HANDLE hInstDll, DWORD dwReason, LPVOID
lpvReserved)
{
SomeThread = CreateThread(NULL, 0,
(LPTHREAD_START_ROUTINE)SomeISTThread,
NULL, 0, NULL);
return TRUE;
}
File Callback.c
PVOID callback_function = NULL;
void Callback()
{
if (callback_function != NULL)
callback_function();
}
void Add_Callback(PVOID callback)
{
callback_function = callback;
}
BOOL Is_CallbackExist()
{
return (callback_function != 0);
}
In debug mode I can see that my callback pointer is passed into the
driver. I can call the callback from the driver. However when an
interrupt is triggered. The function Callback reported that the
callback_function is NULL (which I saw the same result from debug
mode).
P.S. I already passed a function pointer in the variable
callback_function. And I am able to call the callback function from my
application program.
Thanks for the help
.
- Follow-Ups:
- Re: Thread in driver
- From: Valter Minute
- Re: Thread in driver
- From: winstonhyypia
- Re: Thread in driver
- Prev by Date: TTS Application using SAPI
- Next by Date: Re: Thread in driver
- Previous by thread: TTS Application using SAPI
- Next by thread: Re: Thread in driver
- Index(es):
Relevant Pages
|