wangzheng3056 发表于 2013-7-31 14:42

【转】程序猿暖手程序

苦逼程序员没有妹子,没有手套、暖手袋、暖手鼠标套、暖手键盘。唯一有的是,烂笔记本一台。

使用方法:打开程序,1分钟后,手放到风扇口旁。#include <process.h>
#include "windows.h"

double pi = 3.14;

void handwarmer(void *p)
{
        while (1)
        {
                //非线程同步。
                pi *= pi;
                if (pi > 1024*1024*1024)       
                        pi = 3.14;
        }
}

int main()
{
        SYSTEM_INFO siSysInfo;
        GetSystemInfo(&siSysInfo);
       
        //n核 2n线程一样hold住
        for (int i=0; i< (int)siSysInfo.dwNumberOfProcessors*2; ++i)
                _beginthread(handwarmer, 0, 0);
        system("pause");
        return 0;
};

sdccumcm 发表于 2013-7-31 18:39

{:soso_e110:}

上下喵Nathan 发表于 2018-4-7 07:18

呵呵呵呵呵呵呵
页: [1]
查看完整版本: 【转】程序猿暖手程序