Man page - dnsjit.core.channel(3)
Packages contains this manual
- dnsjit.core.object.pcap(3)
- dnsjit.output.null(3)
- dnsjit.core.object.icmp(3)
- dnsjit.core.thread(3)
- dnsjit.lib.trie.node(3)
- dnsjit.lib(3)
- dnsjit.input.mmpcap(3)
- dnsjit.core.object.dns.rr(3)
- dnsjit.output.tlscli(3)
- dnsjit.filter.split(3)
- dnsjit.core.object.udp(3)
- dnsjit.core.channel(3)
- dnsjit.core.object.ip6(3)
- dnsjit.filter.copy(3)
- dnsjit.core.objects(3)
- dnsjit.input(3)
- dnsjit.lib.clock(3)
- dnsjit.core.object.linuxsll2(3)
- dnsjit.input.zmmpcap(3)
- dnsjit.filter.layer(3)
- dnsjit.core.object.gre(3)
- dnsjit.core.object.ether(3)
- dnsjit.core(3)
- dnsjit.core.timespec(3)
- dnsjit.input.zero(3)
- dnsjit.core.file(3)
- dnsjit.core.object.ip(3)
- dnsjit.lib.trie.iter(3)
- dnsjit.core.log(3)
- dnsjit.output(3)
- dnsjit.core.object.linuxsll(3)
- dnsjit.output.pcap(3)
- dnsjit.core.object.payload(3)
- dnsjit.core.object.dns.label(3)
- dnsjit.core.object.dns(3)
- dnsjit.input.pcap(3)
- dnsjit.filter.ipsplit(3)
- dnsjit.lib.parseconf(3)
- dnsjit.core.object(3)
- dnsjit.output.respdiff(3)
- dnsjit.input.fpcap(3)
- dnsjit.lib.getopt(3)
- dnsjit.core.compat(3)
- dnsjit.output.udpcli(3)
- dnsjit.core.object.ieee802(3)
- dnsjit.core.object.icmp6(3)
- dnsjit.output.dnscli(3)
- dnsjit.core.object.loop(3)
- dnsjit.filter(3)
- dnsjit.filter.timing(3)
- dnsjit(1)
- dnsjit.core.receiver(3)
- dnsjit.core.object.dns.q(3)
- dnsjit.core.producer(3)
- dnsjit.lib.base64url(3)
- dnsjit.core.object.tcp(3)
- dnsjit.lib.trie(3)
- dnsjit.output.tcpcli(3)
- dnsjit.core.loader(3)
- dnsjit.lib.ip(3)
- dnsjit.input.zpcap(3)
- dnsjit.core.object.null(3)
apt-get install dnsjit
Manual
dnsjit.core.channel
NAMESYNOPSIS
DESCRIPTION
Attributes
Functions
SEE ALSO
AUTHORS and CONTRIBUTORS
BUGS
NAME
dnsjit.core.channel - Send data to another thread
SYNOPSIS
local chan =
require("dnsjit.core.channel").new()
local thr = require("dnsjit.core.thread").new()
thr:start(function(thr)
local chan = thr:pop()
local obj = chan:get()
...
end)
thr:push(chan)
chan:put(...)
chan:close()
thr:stop()
DESCRIPTION
A channel can be used to send data to another thread, this is done by putting a pointer to the data into a wait-free and lock-free ring buffer (concurrency kit). The channel uses the single producer, single consumer model (SPSC) so there can only be one writer and one reader.
Attributes
int closed
Is 1 if the channel has been closed.
Functions
Channel.new (capacity)
Create a new Channel, use the optional capacity to specify the capacity of the channel (buffer). Capacity must be a power-of-two greater than or equal to 4. Default capacity is 2048.
Channel:log ()
Return the Log object to control logging of this instance or module.
Channel:share ()
Return information to use when sharing this object between threads.
Channel:put (obj)
Put an object into the channel, if the channel is full then it will stall and wait until space becomes available. Object may be nil.
Channel:put (obj)
Try and put an object into the channel. Returns 0 on success.
Channel:get ()
Get an object from the channel, if the channel is empty it will wait until an object is available. Returns nil if the channel is closed or if a nil object was explicitly put into the channel.
Channel:try_get ()
Try and get an object from the channel. Returns nil if there was no objects to get.
Channel:size ()
Return number of enqueued objects.
Channel:full ()
Returns true when channel is full.
Channel:close ()
Close the channel.
Channel:receive ()
Return the C functions and context for receiving objects.
Channel:receiver (o)
Set the receiver to pass objects to. NOTE; The channel keeps no reference of the receiver, it needs to live as long as the channel does.
Channel:run ()
Retrieve all objects from the channel and send it to the receiver.
SEE ALSO
dnsjit.core.thread (3)
AUTHORS and CONTRIBUTORS
Jerry Lundström (DNS-OARC), Tomáš Křížek (CZ.NIC), Petr Špaček (ISC)
Maintained by DNS-OARC
https://www.dns-oarc.net/
BUGS
For issues and feature requests please use:
https://codeberg.org/DNS-OARC/dnsjit/issues
For question and help please use:
admin@dns-oarc.net