Commit graph

16 commits

Author SHA1 Message Date
Xiongfei Guo
02ca593347 Support delete a fd event.
When you call the fd_add, it will return an object with `delete` method.
So you can delete that event if you want.

Signed-off-by: Xiongfei(Alex) Guo <xfguo@credosemi.com>
2014-06-24 14:30:30 +01:00
Xiongfei Guo
79b56268b4 Added fd_add method for uloop lua binding.
Use uloop.fd_add like this:

    local socket = require "socket"

    udp = socket.udp()

    uloop.fd_add(
        udp, -- socket
        function( -- callback function
            ufd,    -- socket object when register the fd
            events  -- uloop events. eg. uloop.ULOOP_READ .
        )
            local words, msg_or_ip, port_or_nil = ufd:receivefrom()
            print('Recv UDP packet from '..msg_or_ip..':'..port_or_nil..' : '..words)
        end,
        uloop.ULOOP_READ -- event you want to listen
    )

The `examples/uloop-example.lua` show an example of this work.

Signed-off-by: Xiongfei(Alex) Guo <xfguo@credosemi.com>
2014-06-24 14:30:30 +01:00
Felix Fietkau
460d94d6e8 blobmsg-example: fix length handling in dump_table() calls 2013-09-11 17:59:33 +02:00
Felix Fietkau
c4b79e4b54 runqueue: move completion handler from runqueue_process to runqueue_task to make it more generic
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-05-09 01:27:45 +02:00
Felix Fietkau
cb6c1718e7 runqueue: add a simple task queueing/completion tracking implementation
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-05-09 01:10:00 +02:00
Felix Fietkau
3ceb819690 ustream-example: fix container_of type errors
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-05-09 01:06:55 +02:00
Felix Fietkau
15ce776772 ustream-example: fix logic inversion 2012-10-23 18:00:20 +02:00
Felix Fietkau
e4027a6327 add a cmake file for the examples and add the binaries to .gitignore 2012-10-21 23:01:30 +02:00
Felix Fietkau
d3b3280055 ustream: add example code 2012-10-21 23:01:12 +02:00
Felix Fietkau
ae3bcf84e1 blobmsg-example: fix compile errors 2012-10-21 03:40:53 +02:00
Felix Fietkau
0a81131257 add an example script for the uloop lua binding 2012-09-27 13:47:46 +02:00
Felix Fietkau
b1ea9afd60 remove uhtbl-test.c, it is obsolete 2012-03-14 11:55:59 +01:00
Felix Fietkau
ff585b97c0 fix json list parsing 2011-01-30 01:13:32 +01:00
Felix Fietkau
5129bc9401 blobmsg: make arrays structually the same as tables - simplifies library user code 2011-01-29 18:00:40 +01:00
Felix Fietkau
461e986a80 remove #if 0'd debug code 2011-01-29 13:05:24 +01:00
Felix Fietkau
e82d74f898 Initial import 2010-10-13 21:29:08 +02:00