workthread.h
来自「用socket++,zthread,occi开发的连数据库处理业务的网络中间件服」· C头文件 代码 · 共 56 行
H
56 行
#ifndef WORKTHREAD_H_#define WORKTHREAD_H_#include <iostream>#include <string>#include "socket++/sockinet.h"#include "zthread/Thread.h"#include "zthread/Mutex.h"#include "zthread/Guard.h"#include "zthread/Condition.h"#include "zthread/ThreadedExecutor.h"#include "occi.h"#include "TQueue.h"#include "Trim.h"#include "interface.h"typedef ZThread::CountedPtr< TQueue<iosockinet*> > SockQueue;class Worker : public ZThread::Runnable { SockQueue sockQueue; int threadno; oracle::occi::StatelessConnectionPool *scp;public: char SendBytes[MAX_SENDBYTES]; int SendLength;public: Worker(SockQueue& sq, int i,oracle::occi::StatelessConnectionPool *scp) : sockQueue(sq), threadno(i),scp(scp) { std::cout << "thread["<<i<<"] boot..."<< std::endl; } void run() { try { while(!ZThread::Thread::interrupted()) { iosockinet *sock = sockQueue->get(); std::cout << "thread["<<threadno<<"] handle"<< std::endl; process_request(sock); } } catch(ZThread::Interrupted_Exception&) { std::cout << "Interrupted_Exception"<<std::endl;} std::cout << "Butterer off"<< std::endl; } int process_request(iosockinet *sock); bool ProcessProcedure(ProcParams *list,std::string &buffer); int doTask(std::string &buffer);};#endif /*WORKTHREAD_H_*/
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?