File: q_push.3

package info (click to toggle)
librecast 0.11.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,760 kB
  • sloc: ansic: 31,144; asm: 28,570; sh: 3,164; makefile: 713; python: 70
file content (63 lines) | stat: -rw-r--r-- 1,267 bytes parent folder | download | duplicates (2)
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
.TH Q_PUSH 3 2023-07-25 "LIBRECAST" "Librecast Programmer's Manual"
.SH NAME
q_push \- push a job onto a smolq queue
.SH LIBRARY
Librecast library
.RI ( liblibrecast ", " \-llibrecast )
.SH SYNOPSIS
.nf
.B #include <librecast/q.h>
.PP
.BI "int  q_push(q_t " *q ", void *(*" f ")(void *), void *restrict " arg ");"
.BI "int  q_trypush(q_t " *q ", void *(*" f ")(void *), void *restrict " arg ");"
.fi
.PP
Compile and link with \fI\-llibrecast\fP.
.SH DESCRIPTION
.BR q_push ()
pushes
.IR f
onto the queue
.IR q
with argument
.IR arg.
.PP
.BR q_trypush ()
is the same as
.BR q_push ()
except that if the queue writer lock cannot be immediately obtained, then the
call returns an error
.RI ( errno
set to
.BR EAGAIN )
instead of blocking.
.PP
.SH RETURN VALUE
The
.BR q_push ()
function returns zero on success. On error, -1 is returned and
.IR errno
is set to indicate the error.
.PP
.SH ERRORS
.TP
.BR EAGAIN
(
.BR q_trypush ())
The operation could not be performed without blocking. (i.e., the queue was
full).
.PP
The function can also fail with the errors for
.BR sem_post (3)
or
.BR sem_wait (3).
.PP
.SH SEE ALSO
.BR q_job_seek (3),
.BR q_pool_create (3),
.BR q_pool_destroy (3),
.BR q_init (3),
.BR q_free (3),
.BR q_wait (3),
.BR sem_post (3),
.BR sem_wait (3)