xiuos/applications/user_api/posix_support/include/semaphore.h

49 lines
1.3 KiB
C

/*
* Copyright (c) 2020 AIIT XUOS Lab
* XiUOS is licensed under Mulan PSL v2.
* You can use this software according to the terms and conditions of the Mulan PSL v2.
* You may obtain a copy of Mulan PSL v2 at:
* http://license.coscl.org.cn/MulanPSL2
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
* See the Mulan PSL v2 for more details.
*/
/**
* @file: semaphore.h
* @brief: the functions definition of posix semaphore
* @version: 1.0
* @author: AIIT XUOS Lab
* @date: 2020/4/20
*
*/
#ifndef SEMAPHORE_H
#define SEMAPHORE_H
#ifdef __cplusplus
extern "C" {
#endif
#include "../../switch_api/user_api.h"
#include <time.h>
typedef int sem_t;
int sem_init(sem_t *sem, int pshared, unsigned int value);
sem_t *sem_open(const char *name, int oflag, ...);
int sem_post(sem_t *sem);
int sem_timedwait(sem_t *sem, const struct timespec *abs_timeout);
int sem_trywait(sem_t *sem);
int sem_unlink(const char *name);
int sem_wait(sem_t *sem);
int sem_getvalue(sem_t *sem, int *sval);
int sem_close(sem_t *sem);
int sem_destroy(sem_t *sem);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* SEMAPHORE_H */