~ubuntu-branches/ubuntu/precise/gnustep-base/precise

« back to all changes in this revision

Viewing changes to Source/NSLock.m

  • Committer: Bazaar Package Importer
  • Author(s): Luca Falavigna
  • Date: 2008-07-05 09:49:51 UTC
  • mfrom: (1.2.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20080705094951-gs19i3erqo2xx6if
Tags: 1.16.1-2ubuntu1
* Merge from Debian unstable, remaining Ubuntu changes:
  + debian/rules:
    - Add lpia to ALL_ARCHS supported architectures.
  + debian/control:
    - Add lpia architecture where needed.
  + debian/control{,.m4}:
    - Update Maintainer field as per spec.

Show diffs side-by-side

added added

removed removed

Lines of Context:
10
10
   This library is free software; you can redistribute it and/or
11
11
   modify it under the terms of the GNU Lesser General Public
12
12
   License as published by the Free Software Foundation; either
13
 
   version 3 of the License, or (at your option) any later version.
 
13
   version 2 of the License, or (at your option) any later version.
14
14
 
15
15
   This library is distributed in the hope that it will be useful,
16
16
   but WITHOUT ANY WARRANTY; without even the implied warranty of
23
23
   Boston, MA 02111 USA.
24
24
 
25
25
   <title>NSLock class reference</title>
26
 
   $Date: 2007-09-14 05:39:44 -0600 (Fri, 14 Sep 2007) $ $Revision: 25483 $
 
26
   $Date: 2008-06-12 11:44:00 +0100 (Thu, 12 Jun 2008) $ $Revision: 26630 $
27
27
*/
28
28
 
29
29
#include "config.h"
167
167
  [super dealloc];
168
168
}
169
169
 
 
170
- (NSString*) description
 
171
{
 
172
  if (_name == nil)
 
173
    return [super description];
 
174
  return [NSString stringWithFormat: @"%@ named '%@'",
 
175
    [super description], _name];
 
176
}
 
177
 
170
178
- (void) gcFinalize
171
179
{
172
180
  if (_mutex != 0)
175
183
      // If there are outstanding locks then it will block
176
184
      if (objc_mutex_deallocate(_MUTEX) == -1)
177
185
        {
178
 
          NSWarnMLog(@"objc_mutex_deallocate() failed");
 
186
          NSWarnMLog(@"objc_mutex_deallocate() failed for %@", self);
179
187
        }
180
188
      _mutex = 0;
181
189
    }
 
190
  DESTROY(_name);
 
191
}
 
192
 
 
193
- (NSString*) name
 
194
{
 
195
  return _name;
 
196
}
 
197
 
 
198
- (void) setName: (NSString*)name
 
199
{
 
200
  ASSIGNCOPY(_name, name);
182
201
}
183
202
 
184
203
/**
304
323
  [super dealloc];
305
324
}
306
325
 
 
326
- (NSString*) description
 
327
{
 
328
  if (_name == nil)
 
329
    return [super description];
 
330
  return [NSString stringWithFormat: @"%@ named '%@'",
 
331
    [super description], _name];
 
332
}
 
333
 
307
334
- (void) gcFinalize
308
335
{
309
336
  if (_condition != 0)
311
338
      // Ask the runtime to deallocate the condition
312
339
      if (objc_condition_deallocate(_CONDITION) == -1)
313
340
        {
314
 
          NSWarnMLog(@"objc_condition_deallocate() failed");
 
341
          NSWarnMLog(@"objc_condition_deallocate() failed for %@", self);
315
342
        }
316
343
    }
317
344
  if (_mutex != 0)
320
347
      // If there are outstanding locks then it will block
321
348
      if (objc_mutex_deallocate(_MUTEX) == -1)
322
349
        {
323
 
          NSWarnMLog(@"objc_mutex_deallocate() failed");
 
350
          NSWarnMLog(@"objc_mutex_deallocate() failed for %@", self);
324
351
        }
325
352
    }
 
353
  DESTROY(_name);
326
354
}
327
355
 
328
356
// Return the current condition of the lock
354
382
    }
355
383
}
356
384
 
 
385
- (NSString*) name
 
386
{
 
387
  return _name;
 
388
}
 
389
 
 
390
- (void) setName: (NSString*)name
 
391
{
 
392
  ASSIGNCOPY(_name, name);
 
393
}
 
394
 
357
395
- (void) unlockWithCondition: (int)value
358
396
{
359
397
  int depth;
600
638
  [super dealloc];
601
639
}
602
640
 
 
641
- (NSString*) description
 
642
{
 
643
  if (_name == nil)
 
644
    return [super description];
 
645
  return [NSString stringWithFormat: @"%@ named '%@'",
 
646
    [super description], _name];
 
647
}
 
648
 
603
649
- (void) gcFinalize
604
650
{
605
651
  if (_mutex != 0)
608
654
      // If there are outstanding locks then it will block
609
655
      if (objc_mutex_deallocate(_MUTEX) == -1)
610
656
        {
611
 
          NSWarnMLog(@"objc_mutex_deallocate() failed");
 
657
          NSWarnMLog(@"objc_mutex_deallocate() failed for %@", self);
612
658
        }
613
659
      _mutex = 0;
614
660
    }
 
661
  DESTROY(_name);
 
662
}
 
663
 
 
664
- (NSString*) name
 
665
{
 
666
  return _name;
 
667
}
 
668
 
 
669
- (void) setName: (NSString*)name
 
670
{
 
671
  ASSIGNCOPY(_name, name);
615
672
}
616
673
 
617
674
/**