=== modified file 'Doc/library/resource.rst' --- Doc/library/resource.rst 2008-01-05 19:33:46 +0000 +++ Doc/library/resource.rst 2010-11-17 13:33:07 +0000 @@ -236,3 +236,8 @@ Pass to :func:`getrusage` to request resources consumed by both the current process and child processes. May not be available on all systems. +.. data:: RUSAGE_THREAD + + Pass to :func:`getrusage` to request resources consumed by the current + thread. May not be available on all systems. + === modified file 'Lib/test/test_resource.py' --- Lib/test/test_resource.py 2009-03-30 22:05:48 +0000 +++ Lib/test/test_resource.py 2010-11-17 13:31:28 +0000 @@ -102,6 +102,10 @@ usageboth = resource.getrusage(resource.RUSAGE_BOTH) except (ValueError, AttributeError): pass + try: + usage_thread = resource.getrusage(resource.RUSAGE_THREAD) + except (ValueError, AttributeError): + pass def test_main(verbose=None): test_support.run_unittest(ResourceTest) === modified file 'Modules/resource.c' --- Modules/resource.c 2010-05-09 14:46:46 +0000 +++ Modules/resource.c 2010-11-17 13:30:32 +0000 @@ -314,6 +314,10 @@ PyModule_AddIntConstant(m, "RUSAGE_BOTH", RUSAGE_BOTH); #endif +#ifdef RUSAGE_THREAD + PyModule_AddIntConstant(m, "RUSAGE_THREAD", RUSAGE_THREAD); +#endif + #if defined(HAVE_LONG_LONG) if (sizeof(RLIM_INFINITY) > sizeof(long)) { v = PyLong_FromLongLong((PY_LONG_LONG) RLIM_INFINITY);