/usr/include/llcv.h is in libion-dev 3.2.1+dfsg-1.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 | /*
llcv.h: definitions enabling the use of in-memory doubly-
linked lists (Lysts) as inter-thread communication
flows.
Like sdrpipes and sdrcvs, llcvs transmit variable-
length messages without flow control: the writing
rate is completely decoupled from the reading rate.
An llcv comprises a Lyst, a mutex, and a condition
variable. The Lyst may be in either private
or shared memory, but the Lyst itself is not shared
with other processes. The reader thread waits on
the condition variable until signaled by a writer
that some condition is now true. The standard
lyst_* API functions are used to populate and
drain the linked list; in order to protect linked
list integrity, each thread must call llcv_lock
before operating on the Lyst and llcv_unlock
afterwards. The other llcv functions merely effect
flow signaling in a way that makes it unnecessary for
the reader to poll or busy-wait on the Lyst.
Copyright (c) 2003, California Institute of Technology.
ALL RIGHTS RESERVED. U.S. Government Sponsorship
acknowledged.
*/
/* Author: Scott Burleigh, Jet Propulsion Laboratory */
/* */
#ifndef _LLCV_H_
#define _LLCV_H_
#ifdef __cplusplus
extern "C" {
#endif
#include "platform.h"
#include "lyst.h"
typedef struct llcv_str
{
Lyst list;
pthread_mutex_t mutex;
pthread_cond_t cv;
} *Llcv;
typedef int (*LlcvPredicate)(Llcv);
/* llcv_wait timeout values */
#define LLCV_POLL (0)
#define LLCV_BLOCKING (-1)
extern int llcv_lyst_is_empty(Llcv Llcv);
/* A built-in "convenience" predicate.
* Returns true if the length of the
* Llcv's encapsulated Lyst is zero,
* false otherwise. */
extern int llcv_lyst_not_empty(Llcv Llcv);
/* A built-in "convenience" predicate.
* Returns true if the length of the
* Llcv's encapsulated Lyst is non-
* zero, false otherwise. */
extern Llcv llcv_open(Lyst list, Llcv llcv);
/* Opens an Llcv, initializing as
* necessary. The list argument must
* point to an existing Lyst, which
* may reside in either private or
* shared dynamic memory. The llcv
* argument must point to an existing
* Llcv management object, which may
* reside in either static or dynamic
* (private or shared) memory -- but
* *NOT* in stack space. Returns NULL
* on any error. */
extern void llcv_lock(Llcv llcv);
/* Locks the Lyst so that it may be
* updated or examined safely by the
* calling thread. Fails silently
* on any error. */
extern void llcv_unlock(Llcv llcv);
/* Unlocks the Lyst so that another
* thread may lock and update or
* examine it. Fails silently on
* any error. */
extern int llcv_wait(Llcv llcv, LlcvPredicate cond, int microseconds);
/* Returns when the Lyst encapsulated
* within the Llcv meets the indicated
* condition. If microseconds is non-
* negative, will alternatively return
* -1 and set errno to ETIMEDOUT when
* the indicated number of microseconds
* has passed. Negative values of the
* microseconds argument other than
* LLCV_BLOCKING are illegal. Returns
* -1 on any error. */
extern void llcv_signal(Llcv llcv, LlcvPredicate cond);
/* Signals to the waiting reader (if
* any) that the Lyst encapsulated in
* the Llcv now meets the indicated
* condition -- but only if it in fact
* does meet that condition. */
extern void llcv_signal_while_locked(Llcv llcv, LlcvPredicate cond);
/* Same as llcv_signal() except does not
* lock the Llcv's mutex before signalling
* or unlock afterwards. For use when
* the Llcv is already locked, to prevent
* deadlock. */
extern void llcv_close(Llcv llcv);
/* Destroys the Llcv management object's
* mutex and condition variable. Fails
* silently (and has no effect) if a
* reader is currently waiting on the Llcv.*/
#ifdef __cplusplus
}
#endif
#endif /* _LLCV_H_ */
|