Esempio n. 1
0
        public static void SbloccaThrPadre()
        {
            var idThrFiglio = Thread.CurrentThread.ManagedThreadId;

            if (listaAttesaThr.ContainsKey(idThrFiglio) == false)
            {
                Log.main.Add(new Mess(LogType.Warn, Log.main.warnUserText, "Nella listaAttesaThr non c'è il seguente thrId:<" + idThrFiglio + ">"));
                return;
            }

            listaAttesaThr[idThrFiglio].Set(); //Sblocca il ThrPadre
            Concur.Dictionary_TryRemove(listaAttesaThr, idThrFiglio);
        }
Esempio n. 2
0
        public static bool Elimina(FrameworkElement ogg, KeyValueTuple <string, object> tag)
        {
            if (CtrlParametri(ogg, tag) == false)
            {
                return(false);
            }

            if (Concur.Dictionary_TryRemove((ConcurrentDictionary <string, object>)ogg.Tag, tag) == false)
            {
                Log.main.Add(new Mess(LogType.ERR, Log.main.errUserText, "Non sono riuscito a rimuovere la tag di nome:<" + tag.Key + "> sul controllo ogg.Name:<" + ogg.Name + ">"));
                return(false);
            }
            return(true);
        }
Esempio n. 3
0
        private void ControlloElementiEStatistiche()
        {
            Int32 elemDaElim; UInt64 totalizzatoreKBSec; bool raggiuntoMaxKBSecTmp, elementoDiInteresse;
            IOrderedEnumerable <KeyValuePair <UInt64, UploadItem> > chiaviValori;

            raggiuntoMaxKBSecTmp = false;
            totalizzatoreKBSec   = 0;

            chiaviValori = from tmp in this.queue
                           where tmp.Value.UploadState == UplItemState.UplCompletato ||
                           tmp.Value.UploadState == UplItemState.TimeoutToStart ||
                           tmp.Value.UploadState == UplItemState.Timeout ||
                           tmp.Value.UploadState == UplItemState.Eccezione
                           orderby tmp.Key ascending
                           select tmp;

            elemDaElim = chiaviValori.Count() - this.config.MaxItemInStatisticsQueue;

            if (elemDaElim < 0)
            {
                elemDaElim = 0;
            }

            //For Each chiaveValore In From c In Me.codaStatistiche  'Può dare errori se gli si modifica il numero degli elementi del dictionary

            foreach (KeyValuePair <UInt64, UploadItem> chiaveValore in chiaviValori)
            {
                elementoDiInteresse = false;

                CheckUploadSubsetEnded(chiaveValore, ref elementoDiInteresse);

                if (raggiuntoMaxKBSecTmp == false && this.config.MaxKBSec > 0)
                {
                    ControlloKBSec(chiaveValore, ref totalizzatoreKBSec, ref raggiuntoMaxKBSecTmp, ref elementoDiInteresse);
                }

                if (elemDaElim > 0 && elementoDiInteresse == false)
                {
                    Concur.Dictionary_TryRemove(this.queue, chiaveValore.Key);
                    elemDaElim -= 1;
                    continue;
                }
            }

            this.raggiuntoMaxKBSec = raggiuntoMaxKBSecTmp;
        }