semaphore.h 628 B

123456789101112131415161718192021222324252627282930313233
  1. /*
  2. * Copyright (c) 2021, the SerenityOS developers.
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <limits.h>
  8. #include <pthread.h>
  9. #include <sys/cdefs.h>
  10. #include <sys/types.h>
  11. __BEGIN_DECLS
  12. typedef struct {
  13. uint32_t value;
  14. } sem_t;
  15. int sem_close(sem_t*);
  16. int sem_destroy(sem_t*);
  17. int sem_getvalue(sem_t*, int*);
  18. int sem_init(sem_t*, int, unsigned int);
  19. sem_t* sem_open(const char*, int, ...);
  20. int sem_post(sem_t*);
  21. int sem_trywait(sem_t*);
  22. int sem_unlink(const char*);
  23. int sem_wait(sem_t*);
  24. int sem_timedwait(sem_t*, const struct timespec* abstime);
  25. #define SEM_VALUE_MAX INT_MAX
  26. __END_DECLS