📄 lsys.cpp
字号:
// ------------------------------------------------// File : lsys.cpp// Date: 4-apr-2002// Author: giles// Desc: // LSys derives from Sys to provide basic Linux functions such as starting threads.//// (c) 2002 peercast.org// ------------------------------------------------// This program is free software; you can redistribute it and/or modify// it under the terms of the GNU General Public License as published by// the Free Software Foundation; either version 2 of the License, or// (at your option) any later version.// This program is distributed in the hope that it will be useful,// but WITHOUT ANY WARRANTY; without even the implied warranty of// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the// GNU General Public License for more details.// ------------------------------------------------#include <time.h>#include <pthread.h>#include <signal.h>#include "lsys.h"#include "lsocket.h"#include "stats.h"// ---------------------------------LSys::LSys(){ stats.clear(); rndGen.setSeed(getTime()); signal(SIGPIPE, SIG_IGN); rndSeed = rnd();}// ---------------------------------unsigned int LSys::getTime(){ time_t ltime; time( <ime ); return ltime;}// ---------------------------------ClientSocket *LSys::createSocket(){ return new LClientSocket();} typedef void *(*THREAD_PTR)(void *);// ---------------------------------bool LSys::startThread(ThreadInfo *info){ info->active = true; pthread_t thread; pthread_attr_t attr; pthread_attr_init(&attr); pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); return pthread_create(&thread,&attr,(THREAD_PTR)info->func,info) == 0;}// ---------------------------------void LSys::sleep(int ms){ ::usleep(ms*1000);}// ---------------------------------void LSys::appMsg(long msg, long arg){ //SendMessage(mainWindow,WM_USER,(WPARAM)msg,(LPARAM)arg);}// ---------------------------------void LSys::getURL(const char *url){}// ---------------------------------void LSys::exit(){ ::exit(0);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -