å¤çº¿ç¨æç¨ï¼æè¿ä¹æ®µè¯
If you are rusty on your C++, let me remind you of the problem. Every C++ member function has a hidden first passed parameter known as the this parameter. Via the this parameter, the function knows which instance of the class to operate upon. Because you never see these this parameters, it is easy to forget they exist.
Now, let's again consider the _beginthread() function which allows us to specify an arbitrary entry-point-function for our new thread. This entry-point-function must accept a single void* passed param. Aye, there's the rub. The function signature required by _beginthread() does not allow the hidden this parameter, and hence a C++ member function cannot be directly activated by _beginthread().
ææå°±æ¯è¯´ï¼C++ç±»ä¸çæåå½æ°å
¶å®é»è®¤å¨åæ°ä¸å
å«æä¸ä¸ªthisæéï¼è¿æ ·æåå½æ°æç¥éåºè¯¥å¯¹åªä¸ªå®ä¾ä½ç¨ãè线ç¨å½æ°å¿
é¡»æ¥åä¸ä¸ªvoidæéä½ä¸ºåæ°ï¼æ以导è´äºçç¾ã为äºè§£å³çç¾ï¼æ们å¯ä»¥ä½¿ç¨staticå½æ°ï¼å®ç¬ç«äºå®ä¾ï¼åæ°ä¸å°ä¸ä¼æthisæéï¼æ以å¯ä»¥ç¨äºæå¼çº¿ç¨ã
温馨提示:答案为网友推荐,仅供参考