Apq.namespace( "Apq.Threading" );

if( !Apq.Threading.Thread )
{
 Apq.Threading.Thread = Apq.Class( "Apq.Threading.Thread" );

/// <t=0>启动延时时间</t>
 /// <m=true>是否允许多次排队</m>
 Apq.Threading.Thread.prototype.ctor = function( ThreadStart, t, args, o, m ){
  this.t = t || 0;
  this.ThreadStart = ThreadStart;
  this.args = args;
  this.o = o;
  this.m = m == null ? true : m;
  this.ids = []; // 排队号码集合
 };
 
 Apq.Threading.Thread.prototype.Enqueue = function(){
  if( !this.m && this.ids.length )
  {
   throw new Error( -1, "该线程不允许重复排队" );
  }
  var id = Apq.setTimeout( this.t, this.ThreadStart, arguments.length ? arguments : this.args, this.o );
  this.ids.push( id );
  return id;
 };
 
 Apq.Threading.Thread.prototype.Dequeue = function( id ){
  id = id || this.ids.concat();
  
  if( id instanceof Array )
  {
   if( id.length )
   {
    for( var i = 0; i < id.length; i++ )
    {
     this.Dequeue( id[i] );
    }
   }
   else
   {
    this.Dequeue();
   }
  }
  else if( this.ids.Contains( id ) )
  {
   clearTimeout( id );
   this.ids.Remove( id );
  }
 };
}

转载于:https://www.cnblogs.com/Apq/archive/2006/06/14/425521.html

Apq.Threading.js相关推荐

  1. edge.js架起node.js和.net互操作桥梁

    今天要介绍的是edge.js这个github上刚兴起的开源项目,它可以让node.js和.net之间在in-process下互操作..net版本在4.5及以上,因为.net4.5带来的Task,asy ...

  2. vue.js crud_如何使用VS Code和ADO.NET使用ASP.NET Core执行CRUD操作

    vue.js crud 介绍 (Introduction) In this article we are going to create a web application using ASP.NET ...

  3. Node.js调用C#代码

    https://github.com/tjanczuk/edge 运行的时候会报 System.DllnotfoundException 无法加载node.dll,要把\packages\Edge.j ...

  4. python重复执行函数_Python threading 单线程 timer重复调用函数

    项目中需要使用定时器,每次都使用构造器函数调用: timer = threading.Timer(timerFlag, upload_position) timer.start() 打印线程后发现,每 ...

  5. 使用Edge.js,在JavaScript中调用C# .Net

    2019独角兽企业重金招聘Python工程师标准>>> Edge.js能够让开发者在JavaScript中调用C#的接口,提高应用的扩展能力.这里介绍如何调用C#接口获取图片数据,并 ...

  6. node.js+express,实现RESTful API

    node代码如下(exptest.js): var express = require('express'); var bodyParser = require('body-parser'); var ...

  7. 通常,Node.js如何处理10,000个并发请求?

    本文翻译自:How, in general, does Node.js handle 10,000 concurrent requests? I understand that Node.js use ...

  8. javascript python 通信_Python通过websocket与js客户端通信示例分析

    具体的 websocket 介绍可见 http://zh.wikipedia.org/wiki/WebSocket 这里,介绍如何使用 Python 与前端 js 进行通信. websocket 使用 ...

  9. c 后台代码调用ajax,.NET Selenium WebDriver操作调用浏览器后台执行Js(JavaScript)代码...

    1.Selenium WebDriver安装引用 注意:要用使用的浏览器肯定要装,并且Selenium.Chrome.WebDriver版本要和浏览器版一致. 如果要操作其它浏览器,则安装对应其它浏览 ...

  10. JS中调用本地Winform程序并传递参数

    场景 JS中调用本地exe程序: JS中调用本地exe程序_BADAO_LIUMANG_QIZHI的博客-CSDN博客 在上面的基础上怎样在js中调用本地winform程序并且传递参数. 注: 博客: ...

最新文章

  1. HiCar人-车-家全场景智慧互联
  2. IDC_ Pro_Env _CentOS 5.4_Open×××
  3. 2014\Province_C_C++_A\2 切面条
  4. 记一次培训机构“面试”过程
  5. Linux改变文件和目录权限-chmodchown
  6. Python学习笔记:文件读/写方法汇总
  7. Ubuntu+Win7+Samba实现文件共享
  8. 深入Java----集合----BitSet
  9. Oracle 基础知识
  10. 颜宁追问4位男科学家:如何平衡事业和家庭?
  11. duilib开发(七):复杂控件介绍
  12. Spring框架浅谈及Spring框架学习小结
  13. 常见蓝屏代码解释及解决方法
  14. .net 生成拼音码与五笔码
  15. 深入理解 Mocha 测试框架:从零实现一个 Mocha
  16. 女人不适合做产品经理?
  17. (《机器学习》完整版系列)附录 ——7、有趣的距离与范数(距离是两点之间的,如果将一个点固定在原点,则为向量的范数)
  18. Neutron DHCP-Agent问题分析定位(1)
  19. ScrollView 嵌套 RecyclerView 高度自适应遇到的问题
  20. 妖精的尾巴手游快速升级辅助 爱蜂窝自动新手挂机升级

热门文章

  1. 28岁,转行学 IT 靠谱吗?
  2. Word2016更改不同的级别标题序号:如2.2 ,2.2.1类标题序号
  3. 0xC0000005: 读取位置 0x00000000 时发生访问冲突
  4. 相机视场角和焦距_摄像机焦距和视场角计算.doc
  5. 油田智能化远程监控系统_油气田长停井图像远程传输监控系统
  6. 中国脑计划颠覆性创新之路六,用互联网与脑科学构建新AI系统模型
  7. embarrass的用法和搭配_embarrass_embarrass的意思和用法搭配
  8. Mushroom Classification(蘑菇分类数据集)
  9. Unity基础案例讲解:创建小型太空射击游戏(二)
  10. linux在拥有/etc/xdg的自启动方式