MyQueue
来源:互联网 发布:linux vi 末行模式 编辑:程序博客网 时间:2024/06/07 01:51
public class MyQueue<T,E> { private Queue<Func<T, E>> pFuncs = new Queue<Func<T, E>>(); private Queue<T> pParmters = new Queue<T>(); private Queue<Action<E>> pActions = new Queue<Action<E>>(); private Boolean isRun = true; public void Init() { Thread thread = new Thread(new ParameterizedThreadStart((obj) => { while (isRun) { if (pFuncs.Count > 0) { for (Int32 iIndex = 0; iIndex < pFuncs.Count; iIndex++ ) { Func<T, E> pFun = pFuncs.Dequeue(); T args = pParmters.Dequeue(); E result = pFun(args); Action<E> pFunction = pActions.Dequeue(); pFunction(result); if (!isRun) break; } } } })) { IsBackground = true }; thread.Start(); } public void Add(T item, Func<T, E> pFun, Action<E> pAction) { pActions.Enqueue(pAction); pFuncs.Enqueue(pFun); pParmters.Enqueue(item); } public void UnInit() { isRun = false; } }
阅读全文
0 0
- MyQueue
- MyQueue Async
- Ch3-5: implement myqueue with 2 stacks
- javax.naming.NameNotFoundException: myqueue not bound
- javax.naming.NameNotFoundException: myqueue not bound
- 【Java】用两个栈实现一个队列Myqueue类
- 【17】Implement a MyQueue class which implements a queue using two stacks
- EJB3.0在发布时出现异常javax.naming.NameNotFoundException: myqueue not bound
- Q3.5 Implement a MyQueue class which implements a queue using two stacks.
- 【STL源码剖析读书笔记】自己实现queue之MyQueue(底层用MyList)
- jboss无法自动创建Queue和Topic 发布时出现错误javax.naming.namenotfoundexception: myqueue not bound
- Looper.myQueue().addIdleHandler,在activty界面显示后做一些事情,就在这个idlehandler中做
- 程序员面试金典: 9.3栈与队列 3.5实现一个MyQueue类,该类用两个栈来实现一个队列
- 使用两个Stack类(JDK容器类库中的Stack类)实现一个队列类MyQueue,提供队列的入队列和出队列操作:enQueue和deQueue
- linux和Windows下用sublime text3编译运行C,C++
- 计蒜客 泥塑课
- 八进制转换为二进制代码
- CentOS 7 64bit下安装Nginx笔记
- nodejs(三)
- MyQueue
- css盒模型
- FCC-Front End Development Basic Projects
- Android学习之Fragment使用
- 虚拟机NAT连接到网络过程
- static和const的作用
- javaweb开发关于用户重复登录的问题
- 单片机时钟程序(2)control.c
- github入门到上传本地项目