Git Product home page Git Product logo

levent's Introduction

levent:

A event library just like libevent or libev but more lighter.

example:

// define callback
void *on_read(int sock, short which, void *args) {}

// main 
include "levent/epoll.h"
Epoll ep(1024);
struct event_s ev[request_num];
int i = 0;
while(i < request_num) {
    // add event
    ep.set(ev + i, fd, EV_READ, on_read, (void *)this);
    ep.add(ev + i);
    i++;
}
// dispatch
ep.dispatch(max_timeout);

TODO:

  • 对事件模型进行了抽象,目前抽象到epoll。已经定义了虚基类,其他模型进行继承即可,接下来会进一步进行抽象和扩展。
  • 最终目标是打造一系列的网络编程生态。

levent's People

Contributors

dingzk avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.