[Scopeapp-cvs]scopeapp/src TraceView.m,1.9,1.10
Status: Alpha
Brought to you by:
narge
From: <sco...@li...> - 2003-01-20 14:14:51
|
Update of /cvsroot/scopeapp/scopeapp/src In directory sc8-pr-cvs1:/tmp/cvs-serv5309/src Modified Files: TraceView.m Log Message: Fix -clearData: to handle changed buffer sizes. Fix this: there should be a method in TraceView which resizes the buffer rather than subclasses modifying myDataWanted[] directly. Index: TraceView.m =================================================================== RCS file: /cvsroot/scopeapp/scopeapp/src/TraceView.m,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** TraceView.m 10 Jan 2003 10:49:27 -0000 1.9 --- TraceView.m 20 Jan 2003 14:14:46 -0000 1.10 *************** *** 180,190 **** -(id) startDrawing { if(myDrawThreadShouldRun) return self; ! myDrawThreadShouldRun = YES; ! [myDrawThreadState lockWhenCondition: kDrawThreadStopped]; [myDrawThreadState unlockWithCondition: kDrawThreadRunning]; ! [NSThread detachNewThreadSelector: @selector(displayThread:) toTarget: self withObject: nil]; --- 180,195 ---- -(id) startDrawing { + // be certain the draw thread is not running if(myDrawThreadShouldRun) return self; + [myDrawThreadState lockWhenCondition: kDrawThreadStopped]; ! // get the buffers ready ! [self clearData]; ! // allow the thread to run ! myDrawThreadShouldRun = YES; [myDrawThreadState unlockWithCondition: kDrawThreadRunning]; ! ! // start the thread [NSThread detachNewThreadSelector: @selector(displayThread:) toTarget: self withObject: nil]; *************** *** 204,212 **** [myDrawThreadState unlockWithCondition: kDrawThreadStopped]; - [self clearData]; - return self; } -(id) freezeDrawing: (BOOL) freeze { --- 209,220 ---- [myDrawThreadState unlockWithCondition: kDrawThreadStopped]; return self; } + -(BOOL) drawing + { + return myDrawThreadShouldRun; + } + -(id) freezeDrawing: (BOOL) freeze { *************** *** 313,316 **** --- 321,330 ---- myDataCollected[1] = 0; + free(myCollectedData[0]); + free(myCollectedData[1]); + + myCollectedData[0] = malloc(sizeof(Sample) * myDataWanted[0]); + myCollectedData[1] = malloc(sizeof(Sample) * myDataWanted[1]); + [myDataLock unlockWithCondition: kWaitingForData]; *************** *** 368,370 **** @end ! // vim:syn=objc:nocin:si: --- 382,384 ---- @end ! // vim:syn=objc:inde=: |