#-*-coding:utf-8-*-__author__='Administrator'fromPyQt4importQt,QtCore,QtGuiimportsys,random,operator,decimal,threading,time,winsoundclassE_24(QtGui.QD...
分类:
其他好文 时间:
2014-10-09 18:27:37
阅读次数:
1014
.Net4.0 任务(Task)任务(Task)是一个管理并行工作单元的轻量级对象。它通过使用CLR的线程池来避免启动专用线程,可以更有效率的利用线程池。System.Threading.Tasks 命名空间下任务相关类一览:类作用Task管理工作单元Task管理带返回值的工作单元TaskFacto...
分类:
Web程序 时间:
2014-10-09 00:05:47
阅读次数:
268
static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e) { } static void CurrentDom...
搞多线程的经常会遇到死锁的问题,学习操作系统的时候会讲到死锁相关的东西,我们用python直观的演示一下。
死锁的一个原因是互斥锁。假设银行系统中,用户a试图转账100块给用户b,与此同时用户b试图转账200块给用户a,则可能产生死锁。
2个线程互相等待对方的锁,互相占用着资源不释放。
#coding=utf-8
import time
import threading
class Acco...
分类:
编程语言 时间:
2014-10-07 20:38:43
阅读次数:
172
Python 的多线程有两种实现方法: 函数,线程类 1.函数 调用 thread 模块中的 start_new_thread() 函数来创建线程,以线程函数的形式告诉线程该做什么# -*- coding: utf-8 -*-import threaddef f(name): #定义线程函数 p.....
分类:
编程语言 时间:
2014-10-04 18:40:07
阅读次数:
186
using System;using System.Collections.Generic;using System.Diagnostics;using System.Linq;using System.Text;using System.Threading;namespace Guoqingxun...
分类:
编程语言 时间:
2014-10-04 10:43:26
阅读次数:
139
使用socket库服务端:tcpServer.py#-*-coding:utf-8-*-
#Filename:tcpServer.py
‘‘‘
server端的socket一般流程是这样:
1.建立一个socket(可以选择socket类型INET,UNIX等,以及连接方式TCP/UDP)
2.使用bind公开一个端口,使得client可以方便连接
3.设置一个listen队列的大小
4...
分类:
其他好文 时间:
2014-10-04 04:07:46
阅读次数:
394
Thread.Sleep in WinRTstatic void Sleep(int ms){new System.Threading.ManualResetEvent(false).WaitOne(ms);}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication1
{
class Program
{
static vo...
分类:
其他好文 时间:
2014-09-30 10:20:22
阅读次数:
155
操纵一个线程 任何程序在执行时,至少有一个主线程,下面这段小程序可以给读者一个直观的印象://SystemThread.csusing System;using System.Threading; namespace ThreadTest{ class RunIt { [STAThr...
分类:
编程语言 时间:
2014-09-29 19:58:42
阅读次数:
303