public int AddToPool(byte[] data_buffer, int priority) { ISingleTask task_to_add = new SingleTask(data_buffer, (task) => this.RemoveFromPool(this._task_counter)); task_to_add.Priority = priority; task_to_add.TaskID = this._task_counter; int session_id = this.s.AddToPool(task_to_add.GetDataBuffer()); this._pool.Add(task_to_add, session_id); this._task_counter += 1; return(task_to_add.TaskID); }
int IComparable.CompareTo(object other) { SingleTask otherSingleTask = other as SingleTask; if (otherSingleTask != null) { if (otherSingleTask.Priority > this.Priority) { return(-1); } else if (otherSingleTask.Priority == this.Priority) { return(0); } else { return(1); } } else { throw new ArgumentException("Object is not a SingleTask"); } }