libiio: iio-lock.h Source File

libiio 1.0 Library for interfacing with IIO devices

Loading...
Searching...
No Matches
iio-lock.h
1/* SPDX-License-Identifier: MIT */
2/*
3 * libiio - Library for interfacing industrial I/O (IIO) devices
4 *
5 * Copyright (C) 2015 Analog Devices, Inc.
6 * Author: Paul Cercueil <paul.cercueil@analog.com>
7 */
8
9#ifndef _IIO_LOCK_H
10#define _IIO_LOCK_H
11
12#include <iio/iio.h>
13
14#define __api __iio_api
15
16struct iio_mutex;
17struct iio_cond;
18struct iio_task;
19struct iio_task_token;
20struct iio_thrd;
21
22__api struct iio_mutex *iio_mutex_create(void);
23__api void iio_mutex_destroy(struct iio_mutex *lock);
24
25__api void iio_mutex_lock(struct iio_mutex *lock);
26__api void iio_mutex_unlock(struct iio_mutex *lock);
27
28__api struct iio_cond * iio_cond_create(void);
29__api void iio_cond_destroy(struct iio_cond *cond);
30
31__api int iio_cond_wait(struct iio_cond *cond, struct iio_mutex *lock,
32 unsigned int timeout_ms);
33__api void iio_cond_signal(struct iio_cond *cond);
34
35__api struct iio_thrd * iio_thrd_create(int (*thrd)(void *),
36 void *d, const char *name);
37__api int iio_thrd_join_and_destroy(struct iio_thrd *thrd);
38
39__api struct iio_task * iio_task_create(int (*task)(void *firstarg, void *d),
40 void *firstarg, const char *name);
41__api void iio_task_flush(struct iio_task *task);
42__api int iio_task_destroy(struct iio_task *task);
43
44__api void iio_task_start(struct iio_task *task);
45__api void iio_task_stop(struct iio_task *task);
46
47__api void iio_task_token_destroy(struct iio_task_token *token);
48__api struct iio_task_token * iio_task_token_create(struct iio_task *task, void *elm);
49__api struct iio_task_token * iio_task_enqueue(struct iio_task *task, void *elm);
50__api int iio_task_enqueue_autoclear(struct iio_task *task, void *elm);
51__api int iio_task_token_enqueue(struct iio_task_token *token);
52
53__api _Bool iio_task_is_done(struct iio_task_token *token);
54__api int iio_task_sync(struct iio_task_token *token, unsigned int timeout_ms);
55__api int iio_task_cancel_sync(struct iio_task_token *token, unsigned int timeout_ms);
56__api void iio_task_cancel(struct iio_task_token *token);
57
58#undef __api
59
60#endif /* _IIO_LOCK_H */
iio.h
Public interface.