07-05-2010 07:07 PM
Hello,
I'm having some difficulty closing (DIsposing) the task, to the extent that I cannot call my routine again. I receive the "NI Platform Services, this resource could not be allocated" message. I've tried to mimic the "GenMultiVoltUpdates_IntCLK" example without luck (i.e it doesn't deallocate the resource).. Basically, the task does not get disposed. What can I do to correct this?
My code is attached (its really quite short). Assume that the double[,] array "waveform" was previously successfully created. Basically, it always works the very first time but never on successive calls. I sorely need help on the TaskEvent handler and Task.Dispose aspects.
Please advise. Thanks. Anand
07-06-2010 11:27 AM
Hi All,
It appears that the TaskDoneEventHandlier is not being invoked.
Since I'm calling it from within a function that I wrote (not a buttonClick routine), is there a chance that its not receiving the right arguments (object sender, Evnetargs e) ?
If I could receive some assitance with this, I'll be really grateful. I've yet to master events and delegates in C#.
Thanks
Anand
07-06-2010 05:21 PM
Hi All,
Instead of depending upon the TaskDoneEventHandler facility, it is also possible to poll the task in the following manner.
- - - - setup waveform
- - - - setup AnalogMultiChannelWriter
- - - - setup Sample Clock
myTask.Start(); // outputs waveform on multiple channels clocked by 'onBoardClock'.
while(! myTask.IsDone) // wait till task completes
{ ; } // do nothing
myTask.Dispose();
This works fine and does not depend upon the TaskDoneEventHandler.
Anand