zoukankan      html  css  js  c++  java
  • Apq.Threading.js

    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 );
      }
     };
    }

  • 相关阅读:
    DOSD用scratch的方式训练通用目标检测,性能很高
    caffemodel模型
    NetScope脱机(localhost)使用[转】
    class前置声明
    const函数
    CUDA开发
    caffe2学习
    faster rcnn讲解很细
    控制台输出覆盖当前行显示
    UA池 代理IP池 scrapy的下载中间件
  • 原文地址:https://www.cnblogs.com/Apq/p/425521.html
Copyright © 2011-2022 走看看