recipe-473781.py 文件源码

python
阅读 18 收藏 0 点赞 0 评论 0

项目:code 作者: ActiveState 项目源码 文件源码
def threadWork():
    threadNo = thread.get_ident()
    # // Local variables
    # double y;
    # PYTHON: NO CODE
    # const double x = 3.14159;
    x = 3.14159
    # const double e = 2.7183;
    e = 2.7183
    # int i;
    # PYTHON: NO CODE
    # const int napTime = 1000;             // in milliseconds
    napTime = 1000
    # const int busyTime = 40000;
    busyTime = 40000
    # DWORD result = 0;
    result = 0

    # // Create load
    # while (runFlag) {
    while runFlag:
        # // Parameterized processor burst phase
        # for (i = 0; i < busyTime; i++)
        for i in range(busyTime):
            # y = pow(x, e);
            y = math.pow(x, e)
        # // Parameterized sleep phase
        # Sleep(napTime);
        time.sleep(napTime / 1000.0)
        # // Write message to stdout
        sys.stdout.write('Thread %s just woke up.\n' % threadNo)
    # }
    # PYTHON: NO CODE
    # // Terminating
    # return result;
    return result
# }
# PYTHON: NO CODE
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号