Up

GSLock documentation

Authors

Richard Frith-Macdonald (rfm@gnu.org)

Date: Generated at 2023-12-20 19:35:46 -0500

Copyright: (C) 2003 Free Software Foundation, Inc.


Contents -

  1. Software documentation for the GSLazyLock class
  2. Software documentation for the GSLazyRecursiveLock class

Software documentation for the GSLazyLock class

GSLazyLock : NSLock

Declared in:
GNUstepBase/GSLock.h
Availability: OpenStep

This implements a class which, when used in single-threaded mode, acts like a lock while avoiding the overheads of actually using a real lock. However, when the programm in which the class is used becomes multi-threaded, all instances of this class transform themselves into real locks in the correct state (locked/unlocked) corresponding to whether the lazy lock was locked or not at the point where the program became multi threadeed.
Use of this class allows you to write thread-safe code which avoids locking inefficiencies when used in a single threaded application, without having to worry about dealing with the issue yourself.

Instance Variables

Method summary

_becomeThreaded: 

- (void) _becomeThreaded: (NSNotification*)n;
Availability: OpenStep

Warning the underscore at the start of the name of this method indicates that it is private, for internal use only, and you should not use the method in your code.
Do not use this method ... it is used internally to handle the transition from a single threaded system to a multi threaded one.



Instance Variables for GSLazyLock Class

locked

@protected int locked;
Availability: OpenStep

Description forthcoming.




Software documentation for the GSLazyRecursiveLock class

GSLazyRecursiveLock : NSRecursiveLock

Declared in:
GNUstepBase/GSLock.h
Availability: OpenStep

This implements a class which, when used in single-threaded mode, acts like a recursive lock while avoiding the overheads of using a real lock. However, when the programm in which the class is used becomes multi-threaded, all instances of this class transform themselves into real locks in the correct state (locked/unlocked) corresponding to whether the lazy recursive lock was locked or not at the point where the program became multi threadeed.
Use of this class allows you to write thread-safe code which avoids locking inefficiencies when used in a single threaded application, without having to worry about dealing with the issue yourself.

Instance Variables

Method summary

_becomeThreaded: 

- (void) _becomeThreaded: (NSNotification*)n;
Availability: OpenStep

Warning the underscore at the start of the name of this method indicates that it is private, for internal use only, and you should not use the method in your code.
Do not use this method ... it is used internally to handle the transition from a single threaded system to a multi threaded one.



Instance Variables for GSLazyRecursiveLock Class

counter

@protected int counter;
Availability: OpenStep

Description forthcoming.





Up