|
2 months ago | |
---|---|---|
.github/workflows | 4 months ago | |
docs | 2 months ago | |
test | 4 months ago | |
.gitignore | 4 months ago | |
LICENSE | 4 months ago | |
Makefile | 4 months ago | |
README.md | 2 months ago | |
module.l | 4 months ago | |
mqueue.l | 4 months ago | |
sysdefs.freebsd | 4 months ago | |
sysdefs.linux | 4 months ago | |
test.l | 4 months ago |
POSIX Message Queues provide a dependency-free mechanism for processes to exchange data in the form of messages.
This library makes it simple to embed support for POSIX Message Queues in PicoLisp applications running on Linux.
v17.12
to v20.7.16
, or pil21
v3.5+
The first step is to run the unit tests: make check
If those fail, jump to the TUTORIALS section to perform the initial setup and system check.
If all works well, then your system is ready to use this library.
The code below illustrates how to use the queue for sending and receiving a message.
(load "mqueue.l") # load the library
(let Fd (pmq-open "/myQ" (list O_RDWR O_CREAT)) # create a read/write queue named "/myQ"
(pmq-send Fd "Hello World") # send the message "Hello World"
(pmq-receive Fd) # receive the message
(pmq-close Fd) # close the queue
(pmq-unlink "/myQ") ) # remove the queue
Note: Verbose output is enabled by default and can be disabled with (off *PMQ_verbose)
.
[2020-09-17T03:37:15] Opened queue: Name='/myqueue', FD=3
[2020-09-17T03:37:15] Send: String='Hello World', Priority=0, FD=3
[2020-09-17T03:37:15] Get attributes: Flags=0, Maxmsg=10, Msgsize=8192, Curmsgs=1, FD=3
[2020-09-17T03:37:15] Receive: String='Hello World' (12 Bytes), FD=3
[2020-09-17T03:37:15] Closed queue: FD=3
[2020-09-17T03:37:15] Unlinked queue: Name='/myqueue'
-> 0
Additional usage and reference documentation can be found in docs/
This library comes with a large suite of unit and integration tests. To run the tests, type:
make check
Copyright (c) 2020 Alexander Williams, On-Prem license@on-premises.com