????C++???泄??泻????谐????????????????????C++??Java?????????椤�????????????????????????????????????????婢�?????????????些???????????????些???????????????
???????????????
????[1] ?楹�?????????? ??i = 0; ++i++?????????????????????????????????????????????????????????????????????????C++??????????????????谩???????????楹�???????楹�???????????????????????????????????????????????????????楹�?????????????楹�??????????????????????????Java????????????????
?????????????
????[1] (5??) C++???????main???????????main??????????些????
????[2] (5??) ??????C++?????????????singleton????????????????????singleton?????????????????socket????????connection??????????? ????????????????
????[3] (5??) ?????????????????????mutex?????????????mutex???蟹????????????????????????????unlock???????????????????
class MutexHelper
{
public:
MutexHelper(TLock& lock):iLock(lock) { pthread_mutex_lock(&iLock); }
~MutexHelper() { ptrhead_mutex_unlock(&iLock); }
}
//TODO: disable assignment and cctor
privae:
pthread_mutex_t& iLock;
};
class Worker
{
public:
Worker() { pthread_mutex_init(&iLock?? NULL); }
~Worker() { pthread_mutex_destroy(&iLock); }
public:
void FuncNeedSync();
private:
pthread_mutex_t iLock;
};
void Worker::FuncNeedSync()
{
MutexHelper helper(iLock);
//TODO: something;
}
????[4] (5??) ??????itoa?????????????????????????????????????????????????????????????????????????????????????????????????????????????
????[5] (4??) C++???static????????????????????????static??????????????????
????[6] (4??) ????????std::string rst?????????????????????????????????????????4k???????????????????????reserve??????????????+=??
????[7] (3??) ?????????些?????std::map??find??????????????????????????????????std::map????????????????????N???????find????????????魏???????????????????????????????????????????????????????械???????? ??????????????????????????google????