1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-30 22:43:12 +03:00

pthread: Refactor semaphore code

The internal semaphore list code is moved to a specific file,
sem_routine.c, and the internal usage is simplified to only two
functions (one to insert a new semaphore and one to remove it
from the internal list).  There is no need to expose the
internal locking, neither how the semaphore mapping is implemented.

No functional or semantic change is expected, tested on
x86_64-linux-gnu.
This commit is contained in:
Adhemerval Zanella
2021-02-03 13:50:21 -03:00
parent e9fed2438a
commit da4aea0b5e
8 changed files with 223 additions and 208 deletions

View File

@ -22,27 +22,6 @@
#define SEM_SHM_PREFIX "sem."
/* Keeping track of currently used mappings. */
struct inuse_sem
{
dev_t dev;
ino_t ino;
int refcnt;
sem_t *sem;
char name[];
};
/* The search tree for existing mappings. */
extern void *__sem_mappings attribute_hidden;
/* Lock to protect the search tree. */
extern int __sem_mappings_lock attribute_hidden;
/* Comparison function for search in tree with existing mappings. */
extern int __sem_search (const void *a, const void *b) attribute_hidden;
static inline void __new_sem_open_init (struct new_sem *sem, unsigned value)
{
#if __HAVE_64B_ATOMICS