src/sortedcache.h


Log

Author Commit Date CI Message
Patrick Steinhardt 0c7f49dd 2017-06-30T13:39:01 Make sure to always include "common.h" first Next to including several files, our "common.h" header also declares various macros which are then used throughout the project. As such, we have to make sure to always include this file first in all implementation files. Otherwise, we might encounter problems or even silent behavioural differences due to macros or defines not being defined as they should be. So in fact, our header and implementation files should make sure to always include "common.h" first. This commit does so by establishing a common include pattern. Header files inside of "src" will now always include "common.h" as its first other file, separated by a newline from all the other includes to make it stand out as special. There are two cases for the implementation files. If they do have a matching header file, they will always include this one first, leading to "common.h" being transitively included as first file. If they do not have a matching header file, they instead include "common.h" as first file themselves. This fixes the outlined problems and will become our standard practice for header and source files inside of the "src/" from now on.
Russell Belfer 19b9a092 2013-08-28T11:20:47 Add stddef include for sortedcache All use of sortedcache will need this header, so put it in the definition of the sortedcache API.
Russell Belfer 805755f4 2013-08-22T15:44:34 Fix sortedcache docs and other feedback This converts an internal lock from a write lock to a read lock where write isn't needed, and also clarifies some doc things about where various locks are acquired and how various APIs are intended to be used.
Russell Belfer 8d9a85d4 2013-08-22T11:40:53 Convert sortedcache to use rwlock This is the first use we have of pthread_rwlock_t in libgit2. Hopefully it won't cause any serious portability problems.
Russell Belfer 3eecadcc 2013-08-21T22:50:37 Improve comments on locking for sortedcache APIs
Russell Belfer a4977169 2013-08-21T14:09:38 Add sortedcache APIs to lookup index and remove This adds two other APIs that I need to the sortedcache type.
Russell Belfer 0b7cdc02 2013-08-20T15:18:48 Add sorted cache data type This adds a convenient new data type for caching the contents of file in memory when each item in that file corresponds to a name and you need to both be able to lookup items by name and iterate over them in some sorted order. The new data type has locks in place to manage usage in a threaded environment.