MCPcopy Create free account
hub / github.com/Hamlib/Hamlib / hl_peek

Function hl_peek

src/fifo.c:84–110  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

82}
83
84int hl_peek(FIFO_RIG *fifo)
85{
86 if (fifo == NULL) { return -1; }
87
88 if (fifo->tail < 0 || fifo->head < 0) { return -1; }
89
90 if (fifo->tail > 1023 || fifo->head > 1023) { return -1; }
91
92 if (fifo->tail == fifo->head) { return -1; }
93
94 pthread_mutex_lock(&fifo->mutex);
95 char c = fifo->data[fifo->head];
96
97#if 0
98
99 if (isalnum(c))
100 rig_debug(RIG_DEBUG_VERBOSE, "%s: peek %c (%d,%d)\n", __func__, c, fifo->head,
101 fifo->tail);
102 else
103 rig_debug(RIG_DEBUG_VERBOSE, "%s: peek 0x%02x (%d,%d)\n", __func__, c,
104 fifo->head,
105 fifo->tail);
106
107#endif
108 pthread_mutex_unlock(&fifo->mutex);
109 return c;
110}
111
112int hl_pop(FIFO_RIG *fifo)
113{

Callers 2

morse_data_handler_stopFunction · 0.85
morse_data_handlerFunction · 0.85

Calls 3

pthread_mutex_lockFunction · 0.85
rig_debugFunction · 0.85
pthread_mutex_unlockFunction · 0.85

Tested by

no test coverage detected