Permalink
Browse files

Merge branch 'master' of github.com:zeusever/lemon-lib

Conflicts:
	io/unix.cmake
  • Loading branch information...
2 parents abe83f5 + 637a887 commit 1e2d2b35d15263a9abc5c0c7ac0ccda420610ddd yayanyang committed Sep 24, 2012
View
BIN .DS_Store
Binary file not shown.
View
@@ -1,4 +1,5 @@
#*#
*~
.git
-build
+build
+*DS_Store
View
Binary file not shown.
View
@@ -5,6 +5,8 @@
#include <lemon/io/io_service_reactor.hpp>
#endif //
+#ifdef LEMON_NULL
+
using namespace lemon;
using namespace lemon::io;
@@ -477,4 +479,6 @@ LEMON_IO_API
{
*errorCode = e;
}
-}
+}
+
+#endif
View
@@ -1,4 +1,5 @@
#cmakedefine LEMON_IO_IOCP
#cmakedefine LEMON_IO_EPOLL
+#cmakedefine LEMON_IO_KQUEUE
View
No changes.
View
@@ -0,0 +1,27 @@
+/**
+*
+* @file io_service_kequeue
+* @brief Copyright (C) 2012 yayanyang All Rights Reserved
+* @author yayanyang
+* @version 1.0.0.0
+* @date 2012/09/12
+*/
+#ifndef LEMON_IO_SERVCIE_KEQUEUE_HPP
+#define LEMON_IO_SERVCIE_KEQUEUE_HPP
+
+#ifdef LEMON_IO_KQUEUE
+#include <lemon/io/socket_reactor.hpp>
+#include <lemon/io/io_service_reactor.hpp>
+
+namespace lemon{namespace io{namespace core{
+
+ class io_service : public basic_io_service<io_service,socket>
+ {
+
+ };
+
+}}}
+
+#endif //
+
+#endif //LEMON_IO_SERVCIE_KEQUEUE_HPP
@@ -4,6 +4,8 @@
namespace lemon{namespace io{namespace core{
+ io_data::io_data(size_t type):_type(type) {}
+
io_data::io_data(size_t type,void * userdata, LemonIOCallback callback, void * buffer, size_t bufferSize)
:_type(type),_userdata(userdata),_callback(callback),_buffer(buffer),_bufferSize(bufferSize)
{
@@ -161,4 +163,4 @@ namespace lemon{namespace io{namespace core{
}
}}}
-#endif //
+#endif //
View
@@ -30,7 +30,7 @@ namespace lemon{namespace io{namespace core{
{
public:
- io_data(size_t type):_type(type) {}
+ io_data(size_t type);
io_data(size_t type,void * userdata, LemonIOCallback callback, void * buffer, size_t bufferSize);
@@ -113,10 +113,6 @@ namespace lemon{namespace io{namespace core{
typedef memory::fixed::allocator<sizeof(accept_io_data)> accept_io_data_allocator;
typedef memory::ringbuffer::allocator<sizeof(io_data*)> complete_queue;
-
- io_service_reactor();
-
- ~io_service_reactor();
void reset() {_exit = false; }
@@ -126,6 +122,12 @@ namespace lemon{namespace io{namespace core{
void post_one(LemonIOCallback callback,void * userdata,void * buffer, size_t bufferSize,LemonErrorInfo *errorCode);
+ protected:
+
+ io_service_reactor();
+
+ ~io_service_reactor();
+
public:
io_data * alloc_io_data(size_t type,void * userdata, LemonIOCallback callback, void * buffer, size_t bufferSize);
View
@@ -8,6 +8,7 @@
*/
#ifndef LEMON_IO_OBJECT_HPP
#define LEMON_IO_OBJECT_HPP
+#include <cstddef>
#include <lemon/io/abi.h>
#include <lemonxx/sys/sys.hpp>
#include <lemonxx/utility/utility.hpp>
@@ -22,7 +23,7 @@ namespace lemon{namespace io{namespace core{
io_object(io_service * service):_ioService(service) {}
- io_object(){}
+ virtual ~io_object(){}
public:
View
@@ -1,10 +1,16 @@
#include <lemon/io/socket.hpp>
#ifdef LEMON_IO_IOCP
#include <lemon/io/io_service_iocp.hpp>
+#elif defined(LEMON_IO_KQUEUE)
+#include <lemon/io/io_service_kqueue.hpp>
#else
#include <lemon/io/io_service_reactor.hpp>
#endif //LEMON_IO_IOCP
+#ifndef WIN32
+#include <unistd.h>
+#endif //WIN32
+
namespace lemon{namespace io{namespace core{
View
@@ -12,6 +12,7 @@
#ifndef WIN32
#define SOCKET_ERROR -1
+#define INVALID_SOCKET -1
#define LEMON_SOCKET_ERROR(errorCode) LEMON_POSIX_ERROR(errorCode,errno)
#else
#define LEMON_SOCKET_ERROR(errorCode) LEMON_WIN32_ERROR(errorCode,WSAGetLastError())
View
@@ -0,0 +1,18 @@
+#include <lemon/io/socket_reactor.hpp>
+
+namespace lemon{namespace io{namespace core{
+
+ socket::socket(int af, int type, int protocol,io_service * service)
+ :socket_base(af,type,protocol,::socket(af,type,protocol),service)
+ {
+
+ }
+
+ socket::socket(int af, int type, int protocol,LemonNativeSock sock, io_service * service)
+ :socket_base(af,type,protocol,sock,service)
+ {
+
+ }
+
+
+}}}
View
@@ -9,6 +9,24 @@
#ifndef LEMON_IO_SOCKET_REACTOR_HPP
#define LEMON_IO_SOCKET_REACTOR_HPP
+#include <lemon/io/socket.hpp>
+#ifndef LEMON_IO_IOCP
+
+
+namespace lemon{namespace io{namespace core{
+
+ class socket : public socket_base
+ {
+ public:
+
+ socket(int af, int type, int protocol,io_service * service);
+
+ socket(int af, int type, int protocol,LemonNativeSock sock, io_service * service);
+ };
+
+}}}
+
+#endif //
#endif //LEMON_IO_SOCKET_REACTOR_HPP
View
@@ -1,3 +1,5 @@
include(CheckIncludeFiles)
check_include_files(sys/epoll.h LEMON_IO_EPOLL)
+
+check_include_files(sys/event.h LEMON_IO_KQUEUE)
View
@@ -44,15 +44,15 @@ LEMON_MESSAGE_API
LEMON_MESSAGE_API
void
- LemonmailboxBind(
+ LemonMailBoxBind(
__lemon_in LemonMailBox mailbox,
__lemon_in const char * url,
__lemon_inout LemonErrorInfo * errorCode);
LEMON_MESSAGE_API
void
- LemonmailboxConnect(
+ LemonMailBoxConnect(
__lemon_in LemonMailBox mailbox,
__lemon_in const char * url,
__lemon_inout LemonErrorInfo * errorCode);
@@ -71,13 +71,13 @@ LEMON_MESSAGE_API
__lemon_inout LemonErrorInfo * errorCode);
-typedef void(*LemonmailboxCallback)(void * userdata,LemonMessage msg,const LemonErrorInfo * errorCode);
+typedef void(*LemonMailBoxCallback)(void * userdata,LemonMessage msg,const LemonErrorInfo * errorCode);
LEMON_MESSAGE_API
void
LemonAsyncReceiveMessage(
__lemon_in LemonMailBox mailbox,
- __lemon_in LemonmailboxCallback callback,
+ __lemon_in LemonMailBoxCallback callback,
__lemon_in void * userdata,
__lemon_inout LemonErrorInfo * errorCode);
@@ -86,7 +86,7 @@ LEMON_MESSAGE_API
LemonAsyncSendMessage(
__lemon_in LemonMailBox mailbox,
__lemon_in LemonMessage msg,
- __lemon_in LemonmailboxCallback callback,
+ __lemon_in LemonMailBoxCallback callback,
__lemon_in void * userdata,
__lemon_inout LemonErrorInfo * errorCode);
View
@@ -1,4 +1,5 @@
lemon_c_cxx_files(SRC)
+
if(WIN32)
lemon_dll_project(lemon-sys BOOTSTRAP1 ${SRC})
else()
View
@@ -10,6 +10,7 @@
#define LEMON_SYS_ABI_H
#include <stdio.h>
#include <wchar.h>
+#include <stdlib.h>
#include <lemon/sys/stdtypes.h>
#include <lemon/sys/configure.h>
#include <lemon/sys/endianess.h>
View
@@ -62,6 +62,8 @@
#cmakedefine LEMON_SUPPORT_IPV6
+#cmakedefine LEMON_USE_BUILDIN_UCONTEXT
+
//define the macro to indicate the wchar_t length
#define LEMON_WCHAR_SIZE ${LEMON_WCHAR_SIZE}
Oops, something went wrong.

0 comments on commit 1e2d2b3

Please sign in to comment.