一、root启动vscode:
vim ~/.bashrc
# 添加别名
alias code='code --user-data-dir "~/.vscode-root" --no-sandbox'
source ~/.bashrc
#直接启动
code
settings.json
{
"files.associations": {
"cmath": "cpp",
"type_traits": "cpp",
"limits": "cpp",
"typeinfo": "cpp"
}
}
二、事件处理
/* File event structure */
typedef struct aeFileEvent {
int mask; /* one of AE_(READABLE|WRITABLE|BARRIER) */
aeFileProc *rfileProc;
aeFileProc *wfileProc;
void *clientData;
} aeFileEvent;
/* Time event structure */
typedef struct aeTimeEvent {
long long id; /* time event identifier. */
monotime when;
aeTimeProc *timeProc;
aeEventFinalizerProc *finalizerProc;
void *clientData;
struct aeTimeEvent *prev;
struct aeTimeEvent *next;
int refcount; /* refcount to prevent timer events from being
* freed in recursive time event calls. */
} aeTimeEvent;
/* A fired event */
typedef struct aeFiredEvent {
int fd;
int mask;
} aeFiredEvent;
/* State of an event based program */
typedef struct aeEventLoop {
int maxfd; /* highest file descriptor currently registered */
int setsize; /* max number of file descriptors tracked */
long long timeEventNextId;
aeFileEvent *events; /* Registered events */
aeFiredEvent *fired; /* Fired events */
aeTimeEvent *timeEventHead;
int stop;
void *apidata; /* This is used for polling API specific data */
aeBeforeSleepProc *beforesleep;
aeBeforeSleepProc *aftersleep;
int flags;
} aeEventLoop;
2.1 accept事件处理
2.1.1 理清 connection、client、aeFileEvent->clientData之间的关系:
aeFileEvent->clientData = connetction
connection->privateData = client
client->conn = connection
2.1.2 调用堆栈
Connection对象创建
client对象创建、并为connection绑定读事件并注册到epoll
2.2 读事件处理
2.3 写入事件处理