Muvicado HD
Loading...
Searching...
No Matches
MutLockDict Class Reference

MutLockDict is a thread-safe version of NSMutableDictionary. More...

#include <MutLockDict.h>

Inheritance diagram for MutLockDict:
Collaboration diagram for MutLockDict:

Instance Methods

(id) - initWithCapacity:
(void) - rdlock
(void) - wrlock
(void) - unlock
(NSMutableDictionary *) - dict
(NSMutableDictionary *) - createDictCopy
(NSMutableDictionary *) - lockCreateDictCopy
(void) - setObject:forKey:
(void) - lockSetObject:forKey:
(void) - setValue:forKey:
(void) - lockSetValue:forKey:
(void) - removeAllObjects
(void) - lockRemoveAllObjects
(id) - objectForKey:
(id) - lockObjectForKey:
(void) - removeObjectForKey:
(void) - lockRemoveObjectForKey:
(void) - addEntriesFromDictionary:
(void) - lockAddEntriesFromDictionary:
(NSArray *) - allKeys
(NSArray *) - lockAllKeys
(NSArray *) - allValues
(NSArray *) - lockAllValues
(NSUInteger) - count
(NSUInteger) - lockCount

Class Methods

(id) + dictionaryWithCapacity:

Protected Attributes

NSMutableDictionary * dict
pthread_rwlock_t dictLock

Detailed Description

MutLockDict is a thread-safe version of NSMutableDictionary.

This class exists because NSMutableDictionary is not thread-safe by default: if you call methods on it from two different threads at the same time, it will try to execute both, often crashing in the process. This class has methods which allow you to work with a mutable dictionary in a transparent and thread-safe manner.

Definition at line 16 of file MutLockDict.h.

Method Documentation

◆ addEntriesFromDictionary:

- (void) addEntriesFromDictionary: (NSDictionary *) otherDictionary

◆ allKeys

- (NSArray *) allKeys
Here is the call graph for this function:
Here is the caller graph for this function:

◆ allValues

- (NSArray *) allValues

Implemented in MutNRLockDict.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ count

- (NSUInteger) count
Here is the call graph for this function:
Here is the caller graph for this function:

◆ createDictCopy

- (NSMutableDictionary *) createDictCopy
Here is the call graph for this function:
Here is the caller graph for this function:

◆ dict

- (NSMutableDictionary *) dict

◆ dictionaryWithCapacity:

+ (id) dictionaryWithCapacity: (NSUInteger) c

◆ initWithCapacity:

- (id) initWithCapacity: (NSUInteger) c

◆ lockAddEntriesFromDictionary:

- (void) lockAddEntriesFromDictionary: (NSDictionary *) otherDictionary

◆ lockAllKeys

- (NSArray *) lockAllKeys
Here is the call graph for this function:
Here is the caller graph for this function:

◆ lockAllValues

- (NSArray *) lockAllValues
Here is the call graph for this function:
Here is the caller graph for this function:

◆ lockCount

- (NSUInteger) lockCount
Here is the call graph for this function:
Here is the caller graph for this function:

◆ lockCreateDictCopy

- (NSMutableDictionary *) lockCreateDictCopy
Here is the call graph for this function:
Here is the caller graph for this function:

◆ lockObjectForKey:

- (id) lockObjectForKey: (NSString *) k

◆ lockRemoveAllObjects

- (void) lockRemoveAllObjects
Here is the call graph for this function:
Here is the caller graph for this function:

◆ lockRemoveObjectForKey:

- (void) lockRemoveObjectForKey: (NSString *) k

◆ lockSetObject:forKey:

- (void) lockSetObject: (id) o
forKey: (NSString *) s 

◆ lockSetValue:forKey:

- (void) lockSetValue: (id) v
forKey: (NSString *) s 

◆ objectForKey:

- (id) objectForKey: (NSString *) k

Implemented in MutNRLockDict.

◆ rdlock

- (void) rdlock
Here is the call graph for this function:
Here is the caller graph for this function:

◆ removeAllObjects

- (void) removeAllObjects
Here is the call graph for this function:
Here is the caller graph for this function:

◆ removeObjectForKey:

- (void) removeObjectForKey: (NSString *) k

◆ setObject:forKey:

- (void) setObject: (id) o
forKey: (NSString *) s 

Implemented in MutNRLockDict.

◆ setValue:forKey:

- (void) setValue: (id) v
forKey: (NSString *) s 

Implemented in MutNRLockDict.

◆ unlock

- (void) unlock
Here is the call graph for this function:
Here is the caller graph for this function:

◆ wrlock

- (void) wrlock
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ dict

- (NSMutableDictionary*) dict
protected

Definition at line 17 of file MutLockDict.h.

◆ dictLock

- (pthread_rwlock_t) dictLock
protected

Definition at line 18 of file MutLockDict.h.


The documentation for this class was generated from the following file: