The libevent API provides a mechanism to execute a callback
function when a specific event occurs on a file descriptor or after a
timeout has been reached.
libevent is meant to replace the asynchronous event loop found in
event driven network servers. An application just needs to call
event_dispatch() and can then add or remove events dynamically
without having to change the event loop.
Currently, libevent supports kqueue(2) and select(2). Support for
poll(2) and /dev/poll is planned. The internal event mechanism is
completely independent of the exposed event API, and a simple
update of libevent can provide this new functionality without
having to redesign the server applications.
More information about event notification mechanisms for network
servers can be found on Dan Kegel's "The C10K problem" web
page. Another library that abstracts asynchronous event
notification is liboop.
참고 자료
http://www.synczone.net/zboard/data/sq_resource/kqueue_echo.c
--------------------------------
관리자 멘트
링크가 너무 길어서 수정했습니다.
그거 예전부터 있던 자료예요
http//www.monkeys.com/freeware/kqueue-echo.c
위 사이트에서 퍼온 자료가 맞을겁니다.
제가 처음 접한 관련소스거든요.
근데 그 소스는 완벽히 구현된 소스가 아닌거 같아요
게다가 제가 원하는건 서로 상호작용할때 어떻게 하면 될까하는 것인데
select로 구현할때보다 더 어려워 보입니다.
그거 보고 스스로 해보라는 뜻이라면 할말이 없지만서두.......
역시 새로운 것은 참 다가가기 힘들군요.
libevent
채팅의 구현은 아니지만...
kqueue와 select를 포장한 이벤트 핸들러 라이브러리 입니다.
0.3이나 0.4 정도 버젼의 소스를 분석해보시면..
님이 원하는 것을 얻을수 있을듯..
최신 버전엔 kqueue 가 빠진듯 하더군요
그리고 시그널이랑, 타이머가 들어가서 분석하실려면 좀 구찮을껍니다.
http://www.monkey.org/~provos/libevent/
The libevent API provides a mechanism to execute a callback
function when a specific event occurs on a file descriptor or after a
timeout has been reached.
libevent is meant to replace the asynchronous event loop found in
event driven network servers. An application just needs to call
event_dispatch() and can then add or remove events dynamically
without having to change the event loop.
Currently, libevent supports kqueue(2) and select(2). Support for
poll(2) and /dev/poll is planned. The internal event mechanism is
completely independent of the exposed event API, and a simple
update of libevent can provide this new functionality without
having to redesign the server applications.
More information about event notification mechanisms for network
servers can be found on Dan Kegel's "The C10K problem" web
page. Another library that abstracts asynchronous event
notification is liboop.
liboop는 http://liboop.org/ 여기가면 얻을 수 있죠
다른 글 모음 http://www.ezdoum.com/search.php?query=kqueue
울랄라~ 호기심 천국~!!
http://www.ezdoum.com
댓글 달기