This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local ffi = require("ffi") | |
local levee = require("levee") | |
ffi.cdef([[ | |
typedef struct { int len; } myproto_prefix_t; | |
]]) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local ffi = require("ffi") | |
local levee = require("levee") | |
ffi.cdef([[ | |
typedef struct { int len; } myproto_prefix_t; | |
]]) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local ffi = require("ffi") | |
local levee = require("levee") | |
local d = levee.d | |
ffi.cdef([[ | |
typedef struct { int len; } myproto_prefix_t; | |
]]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <assert.h> | |
#include <pthread.h> | |
#include <unistd.h> | |
#include <fcntl.h> | |
#include <signal.h> | |
#include <stdio.h> | |
#include <netdb.h> | |
#include <string.h> | |
#include <errno.h> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local levee = require("levee") | |
local _ = levee._ | |
local RPCThreadPool_mt = {} | |
function RPCThreadPool_mt:__index(name) | |
return function(self, ...) | |
local sender, recver = self.h:pipe() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local levee = require("levee") | |
local _ = levee._ | |
local ThreadPool_mt = {} | |
function ThreadPool_mt:__index(name) | |
return function(self, ...) | |
local sender, recver = self.h:pipe() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local levee = require("levee") | |
local _ = levee._ | |
local h = levee.Hub() | |
_.fcntl_nonblock(0); h.stdin = h.io:r(0) | |
_.fcntl_nonblock(1); h.stdout = h.io:w(1) | |
local stream = h.stdin:stream() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local levee = require("levee") | |
local _ = levee._ | |
local h = levee.Hub() | |
_.fcntl_nonblock(0) | |
h.stdin = h.io:r(0) | |
_.fcntl_nonblock(1) | |
h.stdout = h.io:w(1) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const struct rd_kafka_group_list *grplist; | |
err = rd_kafka_list_groups(rk, NULL, &grplist, 5000); | |
assert (!err); | |
for (i = 0 ; i < grplist->group_cnt ; i++) { | |
const struct rd_kafka_group_info *gi = &grplist->groups[i]; | |
printf("%s\n", gi->group); | |
} | |
rd_kafka_group_list_destroy(grplist); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local levee = require("levee") | |
local _ = levee._ | |
local h = levee.Hub() | |
local err, serve = h.http:listen(8099) | |
for conn in serve do | |
h:spawn(function() | |
for req in conn do |