pthread_integration.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /*
  2. * Copyright (c) 2021, the SerenityOS developers.
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <sys/cdefs.h>
  8. #include <sys/types.h>
  9. __BEGIN_DECLS
  10. void __pthread_fork_prepare(void);
  11. void __pthread_fork_child(void);
  12. void __pthread_fork_parent(void);
  13. void __pthread_fork_atfork_register_prepare(void (*)(void));
  14. void __pthread_fork_atfork_register_parent(void (*)(void));
  15. void __pthread_fork_atfork_register_child(void (*)(void));
  16. int __pthread_mutex_init(pthread_mutex_t*, const pthread_mutexattr_t*);
  17. int __pthread_mutex_lock(pthread_mutex_t*);
  18. int __pthread_mutex_trylock(pthread_mutex_t*);
  19. int __pthread_mutex_lock_pessimistic_np(pthread_mutex_t*);
  20. int __pthread_mutex_unlock(pthread_mutex_t*);
  21. typedef void (*KeyDestructor)(void*);
  22. int __pthread_key_create(pthread_key_t*, KeyDestructor);
  23. int __pthread_key_delete(pthread_key_t);
  24. void* __pthread_getspecific(pthread_key_t);
  25. int __pthread_setspecific(pthread_key_t, const void*);
  26. int __pthread_self();
  27. void __pthread_key_destroy_for_current_thread();
  28. #define __PTHREAD_MUTEX_NORMAL 0
  29. #define __PTHREAD_MUTEX_RECURSIVE 1
  30. #define __PTHREAD_MUTEX_INITIALIZER \
  31. { \
  32. 0, 0, 0, __PTHREAD_MUTEX_NORMAL \
  33. }
  34. #define __PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP \
  35. { \
  36. 0, 0, 0, __PTHREAD_MUTEX_RECURSIVE \
  37. }
  38. __END_DECLS