# -*- coding: utf-8 -*-
#python 27
#xiaodeng
#对threading模块源码文件的解读(不全) import threading #类
#Thread() #构造方法
#threading.Thread()
#__init__(self, group=None, target=None, name=None, args=(), kwargs=None, verbose=None)
#group:保留为将来扩展时,可以类被实现
#target:要执行的方法,也叫被调用的方法
#name:is the thread name.
#args:tuple参数,默认(),tuple
#kwargs:关键字参数dict,默认dict
'''
| *group* should be None; reserved for future extension when a ThreadGroup
| class is implemented.
|
| *target* is the callable object to be invoked by the run()
| method. Defaults to None, meaning nothing is called.
|
| *name* is the thread name. By default, a unique name is constructed of
| the form "Thread-N" where N is a small decimal number.
|
| *args* is the argument tuple for the target invocation. Defaults to ().
|
| *kwargs* is a dictionary of keyword arguments for the target
| invocation. Defaults to {}.
|
| If a subclass overrides the constructor, it must make sure to invoke
| the base class constructor (Thread.__init__()) before doing anything
| else to the thread.
''' #__repr__
#作用:返回一个可用来表示对象的可打印字符串
#1)尝试生成这样一个字符串,将其传给eval()可重新生成同样的对象
#2)一个类class可以通过__repr__成员来控制repr()函数作用在其实例上时的行为
class D():
def __str__(self):
return 'a.__str_-'
def __repr__(self):
return 'a.__repr__' '''
>>> dr=D()
>>> dr
a.__repr__
>>> print dr
a.__str_-
''' #getName(self):返回线程名 #isAlive(self): 返回线程是否活动的 #isDaemon(self):判断线程是否随主线程一起结束 #join(self, timeout=None):等待线程终止,Wait until the thread terminates. #run(self):表示线程活动的方法。 #setDaemon(self, daemonic)#设置子线程是否随主线程一起结束,必须在start()之前调用。默认为False。 #setName(self, name):设置线程对象名称 #start(self):启动线程

对threading模块源码文件的解读(不全)的更多相关文章

  1. Erlang千万级用户游戏框架(Openpoker)源码文件分析清单

    openpoker源码 erlang写的网游服务器源码,OpenPoker是一个大型多人扑克网游,内建支持了容错能力,负载平衡和无限制的规模大小.本文是openpoker源码文件功能的一个清单式说明: ...

  2. 《UNIX网络编程(第3版)》unp.h等源码文件的编译安装

    操作系统:Mac OS X 10.11.5 1.下载书中的源代码:点击下载 2.切换到解压后的目录 unpv13e,先查看下 README,依次执行: ./configure cd lib make ...

  3. [C/C++] 各种C/C++编译器对UTF-8源码文件的兼容性测试(VC、GCC、BCB)

    在不同平台上开发C/C++程序时,为了避免源码文件乱码,得采用UTF-8编码来存储源码文件.但是很多编译器对UTF-8源码文件兼容性不佳,于是我做了一些测试,分析了最佳保存方案. 一.测试程序 为了测 ...

  4. C++ 多源码文件简单组织

    C++ 多源码文件简单组织 基本上和C的是一样的,只不过C++的方法要在类中声明.看一个简单实例.ainimal.h  类里面对外公开的信息. 点击(此处)折叠或打开 #ifndef _ANIMAL_ ...

  5. Python源码文件中带有中文时,输出乱码

    Python源码文件中带有中文时,文件头应加注释: #!/usr/bin/env python # -*- coding: utf-8 -*- 第一行注释是为了告诉Linux/OS X系统,这是一个P ...

  6. TFS二次开发-基线文件管理器(5)-源码文件的读取

      在上一节中,我们在保存标签之前,已经将勾选的文件路径保存到了Listbox中,这里只需要将保存的数据输出去为txt文档就可以做版本控制了.   版本文件比较复杂的是如何读取,也就是如何通过文件路径 ...

  7. go语言的源码文件的分类及含义

    Go源码文件:名称以.go为后缀,内容以Go语言代码组织的文件 多个Go源码文件是需要用代码包组织起来的 源码文件分为三类:命令源码文件.库源码文件(go语言程序) 测试源码文件(辅助源码文件) 命令 ...

  8. golang学习笔记---命令源码文件接收参数(flag包)

    命令源码文件怎样接收参数 go标准库中有一个代码包专门用于接收和解析命令参数.这个包叫flag 实例1: package main import ( "flag" "fm ...

  9. golang---命令源码文件与命令行参数

    命令源码文件是程序的运行入口,是每个可独立运行的程序必须拥有的. import "flag"  flag包实现了命令行参数的解析.每个参数认为一条记录,根据实际进行定义,到一个se ...

随机推荐

  1. 企业应用:C/S 开发需要考虑的事项

    备注 几乎没有做过 C/S 方面的开发(有 RIA 方面的开发经验),此文纯属个人胡思乱想,写下来是希望朋友们多给点意见. C/S 开发注意事项 C/S 开发需要注意如下几点: 采用何种模式组织 UI ...

  2. 《Windows核心编程》第3章——handle复制相关实验

    先写一个程序,用来查看进程的内核对象,这样我们就能比较子进程是否继承了父进程的某个句柄: #include <windows.h> #include <stdio.h> #de ...

  3. Spring与web MVC的整合——Spring的应用上下文管理

    问题1 如何让web容器加载你的web MVC框架 对于基于servlet的web容器来说,遵循的是servlet规范,入口配置文件是web.xml.这类web容器会在启动的时候会而且仅会加载如下三种 ...

  4. iOS:UITableView表格视图控件

    UITableView:表格视图控件,继承滚动视图控件UIScrollView,(类似于UIPickerView选择器,它主要通过设置数据源代理和行为代理实现协议来设置单元格)    对表格的操作主要 ...

  5. An easier way to debug windows services

    Have you got tired of attaching the Visual Studio debugger to the service application? I got the sol ...

  6. [leetcode]Remove Nth Node From End of List @ Python

    原题地址:http://oj.leetcode.com/problems/remove-nth-node-from-end-of-list/ 题意: Given a linked list, remo ...

  7. Managed Debugging Assistant 'PInvokeStackImbalance' has detected a problem in 解决方案

    because regular C functions work differently than the Windows API functions; their "calling con ...

  8. HttpWebRequest的使用

    HttpWebRequest类主要利用HTTP 协议和服务器交互,通常是通过 GET 和 POST 两种方式来对数据进行获取和提交.下面对这两种方式进行一下说明: GET 方式 GET 方式通过在网络 ...

  9. Android之属性动画(二)

    上一篇文章(链接:http://www.cnblogs.com/jerehedu/p/4458928.html  ),我们对属性动画有了简单的认识,并实际动手使用ObjectAnimator.Anim ...

  10. statickeyword

    static词义:静态的,可以用于修饰变量和方法,static方法块可以优先于构造函数运行. 被static修饰的变量,叫静态变量,静态变量在内存中仅仅有一份拷贝 public static Stri ...