Skip to content
Snippets Groups Projects
Commit f6e0279b authored by Dmitriy A. Gerasimov's avatar Dmitriy A. Gerasimov
Browse files

[*] Fixed for EPOLL

parent 6453d10e
No related branches found
No related tags found
3 merge requests!251Master,!250Master,!220bugs-4547
Pipeline #5611 passed with stage
in 11 seconds
......@@ -2,7 +2,7 @@ project(cellframe-sdk C)
cmake_minimum_required(VERSION 2.8)
set(CMAKE_C_STANDARD 11)
set(CELLFRAME_SDK_NATIVE_VERSION "2.5-25")
set(CELLFRAME_SDK_NATIVE_VERSION "2.5-26")
add_definitions ("-DCELLFRAME_SDK_VERSION=\"${CELLFRAME_SDK_NATIVE_VERSION}\"")
set(DAPSDK_MODULES "")
......
......@@ -161,11 +161,11 @@ static void * s_proc_thread_function(void * a_arg)
l_thread->proc_event->_inheritor = l_thread; // we pass thread through it
#ifdef DAP_EVENTS_CAPS_EPOLL
struct epoll_event l_epoll_events[DAP_MAX_EPOLL_EVENTS], l_ev;
struct epoll_event l_epoll_events[DAP_EVENTS_SOCKET_MAX], l_ev;
memset(l_epoll_events, 0,sizeof (l_epoll_events));
// Create epoll ctl
l_thread->epoll_ctl = epoll_create( DAP_MAX_EPOLL_EVENTS );
l_thread->epoll_ctl = epoll_create( DAP_EVENTS_SOCKET_MAX );
// add proc queue
l_ev.events = l_thread->proc_queue->esocket->ev_base_flags;
......@@ -183,7 +183,7 @@ static void * s_proc_thread_function(void * a_arg)
return NULL;
}
#elif defined(DAP_EVENTS_CAPS_POLL)
size_t l_poll_count_max = DAP_MAX_EVENTS_COUNT;
size_t l_poll_count_max = DAP_EVENTS_SOCKET_MAX;
size_t l_poll_count = 0;
bool l_poll_compress = false;
struct pollfd * l_poll = DAP_NEW_Z_SIZE(struct pollfd,l_poll_count_max *sizeof (*l_poll));
......@@ -214,7 +214,7 @@ static void * s_proc_thread_function(void * a_arg)
#ifdef DAP_EVENTS_CAPS_EPOLL
//log_it(L_DEBUG, "Epoll_wait call");
int l_selected_sockets = epoll_wait(l_thread->epoll_ctl, l_epoll_events, DAP_MAX_EPOLL_EVENTS, -1);
int l_selected_sockets = epoll_wait(l_thread->epoll_ctl, l_epoll_events, DAP_EVENTS_SOCKET_MAX, -1);
size_t l_sockets_max = l_selected_sockets;
#elif defined (DAP_EVENTS_CAPS_POLL)
int l_selected_sockets = poll(l_poll,l_poll_count,-1);
......
......@@ -85,10 +85,10 @@ void *dap_worker_thread(void *arg)
pthread_setschedparam(pthread_self(),SCHED_FIFO ,&l_shed_params);
#ifdef DAP_EVENTS_CAPS_EPOLL
struct epoll_event l_epoll_events[ DAP_MAX_EPOLL_EVENTS]= {{0}};
struct epoll_event l_epoll_events[ DAP_EVENTS_SOCKET_MAX]= {{0}};
log_it(L_INFO, "Worker #%d started with epoll fd %d and assigned to dedicated CPU unit", l_worker->id, l_worker->epoll_fd);
#elif defined(DAP_EVENTS_CAPS_POLL)
l_worker->poll_count_max = _SC_PAGE_SIZE;
l_worker->poll_count_max = DAP_EVENTS_SOCKET_MAX;
l_worker->poll = DAP_NEW_Z_SIZE(struct pollfd,l_worker->poll_count_max*sizeof (struct pollfd));
l_worker->poll_esocket = DAP_NEW_Z_SIZE(dap_events_socket_t*,l_worker->poll_count_max*sizeof (dap_events_socket_t*));
#else
......@@ -109,7 +109,7 @@ void *dap_worker_thread(void *arg)
bool s_loop_is_active = true;
while(s_loop_is_active) {
#ifdef DAP_EVENTS_CAPS_EPOLL
int l_selected_sockets = epoll_wait(l_worker->epoll_fd, l_epoll_events, DAP_MAX_EPOLL_EVENTS, -1);
int l_selected_sockets = epoll_wait(l_worker->epoll_fd, l_epoll_events, DAP_EVENTS_SOCKET_MAX, -1);
size_t l_sockets_max = l_selected_sockets;
#elif defined(DAP_EVENTS_CAPS_POLL)
int l_selected_sockets = poll(l_worker->poll, l_worker->poll_count, -1);
......
......@@ -30,6 +30,8 @@
#include "dap_common.h"
#define DAP_EVENTS_SOCKET_MAX 8194
// Caps for different platforms
#if defined(DAP_OS_LINUX)
#define DAP_EVENTS_CAPS_EPOLL
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment