Simplification of messy nlocking code.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@25134 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2007-05-10 15:41:54 +00:00
parent daa056545a
commit 3c63d253cf
3 changed files with 4 additions and 19 deletions

View file

@ -1,7 +1,7 @@
2007-05-10 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSAnimation.m: removed some C99-isms and fixed bug in
use of boolean.
* Source/NSAnimation.m: removed some C99-isms and simplified by
removing attempt to avoid locking when in single threaded mode.
* Headers/AppKit/NSAnimation.h: added an ivar and FIXME comments.
2007-05-08 Riccardo Mottola <rmottola@users.sf.net>

View file

@ -139,8 +139,6 @@ APPKIT_EXPORT NSString *NSAnimationProgressMark;
BOOL (*_delegate_animationShouldStart )(id,SEL,NSAnimation*);
id _currentDelegate; // The delegate when the animation is running
BOOL _isThreaded;
BOOL __gs_isLocked;
NSRecursiveLock *_isAnimatingLock;
}

View file

@ -27,6 +27,7 @@
*/
#include <AppKit/NSAnimation.h>
#include <GNUstepBase/GSLock.h>
#include <Foundation/NSNotification.h>
#include <Foundation/NSValue.h>
#include <Foundation/NSException.h>
@ -178,24 +179,14 @@ nsanimation_progressMarkSorter ( NSAnimationProgress first,NSAnimationProgress s
}
#define _NSANIMATION_LOCK \
if (_isThreaded) \
{ \
NSAssert(__gs_isLocked == NO, NSInternalInconsistencyException); \
NSDebugFLLog(@"NSAnimationLock",\
@"%@ LOCK %@",self,[NSThread currentThread]);\
[_isAnimatingLock lock]; \
__gs_isLocked = YES; \
}
#define _NSANIMATION_UNLOCK \
if (_isThreaded) \
{ \
NSAssert(__gs_isLocked == YES, NSInternalInconsistencyException); \
NSDebugFLLog(@"NSAnimationLock",\
@"%@ UNLOCK %@",self,[NSThread currentThread]);\
__gs_isLocked = NO; \
[_isAnimatingLock unlock]; \
}
@implementation NSAnimation
@ -412,8 +403,7 @@ nsanimation_progressMarkSorter ( NSAnimationProgress first,NSAnimationProgress s
_delegate_animationShouldStart =
(BOOL (*)(id,SEL,NSAnimation*)) NULL;
_isThreaded = NO;
_isAnimatingLock = [[NSRecursiveLock alloc] init];
_isAnimatingLock = [GSLazyRecursiveLock new];
}
return self;
}
@ -801,7 +791,6 @@ nsanimation_progressMarkSorter ( NSAnimationProgress first,NSAnimationProgress s
[_animator startAnimation];
break;
case NSAnimationNonblockingThreaded:
_isThreaded = YES;
[NSThread
detachNewThreadSelector: @selector (_gs_startThreadedAnimation)
toTarget: self
@ -1050,7 +1039,6 @@ nsanimation_progressMarkSorter ( NSAnimationProgress first,NSAnimationProgress s
- (void) _gs_startThreadedAnimation
{
// NSAssert(_isThreaded);
CREATE_AUTORELEASE_POOL (pool);
NSDebugFLLog (@"NSAnimationThread",
@"%@ Start of %@",self,[NSThread currentThread]);
@ -1058,7 +1046,6 @@ nsanimation_progressMarkSorter ( NSAnimationProgress first,NSAnimationProgress s
NSDebugFLLog (@"NSAnimationThread",
@"%@ End of %@",self,[NSThread currentThread]);
RELEASE (pool);
_isThreaded = NO;
}