Beispiel #1
0
        /// <summary>
        /// 设置值
        /// </summary>
        /// <param name="value">值</param>
        /// <param name="callback">返回回调</param>
        /// <returns>true设置成功, false 此对象已经停止工作了</returns>
        public bool Set(SET value, Action <RES> callback)
        {
            lock (lockObj)
            {
                if (Target == null)
                {
                    return(false);
                }

                if (State == FiberFlag.Complete)
                {
                    return(false);
                }

                ResCallbackModel tmp = new ResCallbackModel()
                {
                    ResCallBack = callback,
                    value       = value
                };



                SetQueue.Enqueue(tmp);


                return(true);
            }
        }
Beispiel #2
0
            internal static void Enqueue(BaseCacheAddParameters parameters)
            {
                Log("RefillQueue", () => parameters.Name);

                lock (s_BackgroundQueue)
                {
                    s_BackgroundQueue.Enqueue(parameters);
                    EnsureBackgroundThread();
                }
            }