优化源码配置宏位置,方便个性化编译
This commit is contained in:
@ -83,7 +83,7 @@ int rbt_parse_json(const char *json_text, rbt_msg *out)
|
||||
ssize_t read_req(int fd, void *buf)
|
||||
{
|
||||
// TODO 修改读取任务函数
|
||||
ssize_t n = read(fd, buf, MAX_MESSAGE_BUF);
|
||||
ssize_t n = read(fd, buf, NET_MAX_MESSAGE_BUF);
|
||||
if (n == 0) /* 写端已关闭,管道永不会再有数据 */
|
||||
return 0;
|
||||
return (n > 0) ? n : -1;
|
||||
@ -137,7 +137,7 @@ int iss_work(netm *self,char *command)
|
||||
//查询空闲线程
|
||||
while(atomic_load(&(self->pool[i].status)) ==0)
|
||||
{
|
||||
if(i<MAX_POOL)
|
||||
if(i<NET_MAX_POOL)
|
||||
i++;
|
||||
else{
|
||||
i=0;
|
||||
@ -182,7 +182,7 @@ void *pth_module(void *args_p)
|
||||
for(;;){
|
||||
//线程池中,单个线程模型
|
||||
|
||||
char *req = (char*)malloc(MAX_MESSAGE_BUF);
|
||||
char *req = (char*)malloc(NET_MAX_MESSAGE_BUF);
|
||||
//从管道中读取请求,并解析,无内容时休眠
|
||||
int n = read_req(pmd->fifo_fd[0],(void*)req);
|
||||
//管道关闭时退出;
|
||||
@ -203,7 +203,7 @@ void *pth_module(void *args_p)
|
||||
|
||||
int start_pool(netm *self)
|
||||
{
|
||||
for(int i = 0;i<MAX_POOL;i++)
|
||||
for(int i = 0;i<NET_MAX_POOL;i++)
|
||||
{
|
||||
//为线程开辟管道
|
||||
pipe(self->pool[i].fifo_fd);
|
||||
@ -219,7 +219,7 @@ int start_pool(netm *self)
|
||||
|
||||
int shutdown_pool(netm *self)
|
||||
{
|
||||
for(int i = 0;i<MAX_POOL;i++)
|
||||
for(int i = 0;i<NET_MAX_POOL;i++)
|
||||
{
|
||||
if(self->pool[i].status == -1)
|
||||
continue;
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
#ifndef SWAP
|
||||
#define SWAP
|
||||
|
||||
#include "config.h"
|
||||
#define QUITPLG 0
|
||||
#define NEWMSG 1
|
||||
#define FREE 2
|
||||
|
||||
Reference in New Issue
Block a user