1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-23 18:25:08 +00:00
serenity/Userland/Libraries/LibC/bits/pthread_integration.h
Sergey Bugaev 5536f3c277 LibC: Add __pthread_mutex_lock_pessimistic_np()
This is a private function that locks the lock much like the regular
pthread_mutex_lock(), but causes the corresponding unlock operation to
always assume there may be other waiters. This is useful in case some
waiters are made to wait on the mutex's futex directly, without going
through pthread_mutex_lock(). This is going to be used by the condition
variable implementation in the next commit.
2021-07-05 20:26:01 +02:00

45 lines
1.2 KiB
C

/*
* Copyright (c) 2021, the SerenityOS developers.
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <sys/cdefs.h>
#include <sys/types.h>
__BEGIN_DECLS
void __pthread_fork_prepare(void);
void __pthread_fork_child(void);
void __pthread_fork_parent(void);
void __pthread_fork_atfork_register_prepare(void (*)(void));
void __pthread_fork_atfork_register_parent(void (*)(void));
void __pthread_fork_atfork_register_child(void (*)(void));
int __pthread_mutex_init(pthread_mutex_t*, const pthread_mutexattr_t*);
int __pthread_mutex_lock(pthread_mutex_t*);
int __pthread_mutex_trylock(pthread_mutex_t*);
int __pthread_mutex_lock_pessimistic_np(pthread_mutex_t*);
int __pthread_mutex_unlock(pthread_mutex_t*);
typedef void (*KeyDestructor)(void*);
int __pthread_key_create(pthread_key_t*, KeyDestructor);
int __pthread_key_delete(pthread_key_t);
void* __pthread_getspecific(pthread_key_t);
int __pthread_setspecific(pthread_key_t, const void*);
int __pthread_self();
void __pthread_key_destroy_for_current_thread();
#define __PTHREAD_MUTEX_NORMAL 0
#define __PTHREAD_MUTEX_RECURSIVE 1
#define __PTHREAD_MUTEX_INITIALIZER \
{ \
0, 0, 0, __PTHREAD_MUTEX_NORMAL \
}
__END_DECLS