X-Git-Url: https://git.saurik.com/redis.git/blobdiff_plain/2612e0521fde55db2c720092d4ad02a8f015f46e..fec5a664f8ce7a1e0f687d07079aa09230fa5846:/src/dict.h?ds=sidebyside diff --git a/src/dict.h b/src/dict.h index 25cce4e5..74bcd2aa 100644 --- a/src/dict.h +++ b/src/dict.h @@ -74,10 +74,13 @@ typedef struct dict { int iterators; /* number of iterators currently running */ } dict; +/* If safe is set to 1 this is a safe iteartor, that means, you can call + * dictAdd, dictFind, and other functions against the dictionary even while + * iterating. Otherwise it is a non safe iterator, and only dictNext() + * should be called while iterating. */ typedef struct dictIterator { dict *d; - int table; - int index; + int table, index, safe; dictEntry *entry, *nextEntry; } dictIterator; @@ -132,6 +135,7 @@ dictEntry * dictFind(dict *d, const void *key); void *dictFetchValue(dict *d, const void *key); int dictResize(dict *d); dictIterator *dictGetIterator(dict *d); +dictIterator *dictGetSafeIterator(dict *d); dictEntry *dictNext(dictIterator *iter); void dictReleaseIterator(dictIterator *iter); dictEntry *dictGetRandomKey(dict *d);