G
Guest
Hi all,
I have a problem with an application that is consuming events from an
unmanaged dll.
I use the following pseudo-code to create and register my eventhandler:
System.Threading.WaitHandle myEvent = new AutoResetEvent(false);
// Register the event to my eventhandler
RegisteredWaitHandle myEventHandleReg=
ThreadPool.RegisterWaitForSingleObject(myEvent, new
WaitOrTimerCallback(myEventHandler), this, 1000, false);
I also call a function in the unmanaged dll where one of the arguments is a
reference to myEvent to register the event there.
This has been working like a charm during application tests and development
but now in my production enviroment I have started to experience problems.
The eventhandler is not triggered as often as I would like it to.
Could this be related to heavy load on my system (processor busy)?
The events are raised pretty much 500 ms apart all the time and if my
application for some reason is busy for 1000 ms would that result in an event
not being able to trigger the eventhandler or will the events line up in a
queue and get processed when the application is ready?
Is there any reason to use a ManualResetEvent to maybe be more robust?
Any suggestions would be appreciated
Best regards
Henrik
I have a problem with an application that is consuming events from an
unmanaged dll.
I use the following pseudo-code to create and register my eventhandler:
System.Threading.WaitHandle myEvent = new AutoResetEvent(false);
// Register the event to my eventhandler
RegisteredWaitHandle myEventHandleReg=
ThreadPool.RegisterWaitForSingleObject(myEvent, new
WaitOrTimerCallback(myEventHandler), this, 1000, false);
I also call a function in the unmanaged dll where one of the arguments is a
reference to myEvent to register the event there.
This has been working like a charm during application tests and development
but now in my production enviroment I have started to experience problems.
The eventhandler is not triggered as often as I would like it to.
Could this be related to heavy load on my system (processor busy)?
The events are raised pretty much 500 ms apart all the time and if my
application for some reason is busy for 1000 ms would that result in an event
not being able to trigger the eventhandler or will the events line up in a
queue and get processed when the application is ready?
Is there any reason to use a ManualResetEvent to maybe be more robust?
Any suggestions would be appreciated
Best regards
Henrik