[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: NSSound Reimplementation
From: |
Fred Kiefer |
Subject: |
Re: NSSound Reimplementation |
Date: |
Fri, 19 Jun 2009 09:05:47 +0200 |
User-agent: |
Thunderbird 2.0.0.19 (X11/20081227) |
Stefan Bidigaray wrote:
> It would really help if I attached the file...
>
I don't understand the general concept here, so just a few detail
comments on the code itself.
Hiding the implementation details in the header is a good thing, but it
makes the code in the implementation harder to read. This could be
improved by using local variables (or even Macros). For example
- (BOOL) pause
{
NSConditionLock *lock = (NSConditionLock*)_private[2];
if ([lock condition] == SOUND_SHOULD_PAUSE)
{
return NO;
}
if ([lock tryLock] == NO)
{
return NO;
}
[lock unlockWithCondition: SOUND_SHOULD_PAUSE];
return YES;
}
When releasing the conditional lock, you should rather destroy it, as it
could otherwise just be reused, although it has been freed.
Shouldn't the condition of the while loop read something like this?
while ((!_shouldExit) && (bytesRead > 0) && success)
Re: NSSound Reimplementation, Stefan Bidigaray, 2009/06/24
- Re: NSSound Reimplementation, Stefan Bidigaray, 2009/06/26
- Re: NSSound Reimplementation, Stefan Bidigaray, 2009/06/27
- Re: NSSound Reimplementation, Wolfgang Lux, 2009/06/27
- Re: NSSound Reimplementation, Wolfgang Lux, 2009/06/28
- Re: NSSound Reimplementation, Stefan Bidigaray, 2009/06/28