Пример #1
0
Файл: Thread.cs Проект: M1C/Eto
 public Thread(Generator generator, Action action)
     : base(generator, typeof(IThread))
 {
     inner = (IThread)Handler;
     this.action = action;
     inner.Create();
 }
Пример #2
0
        MessagesBuilderCallback CreateMessageBuilderCallback()
        {
            IThread fakeThread = null;

            //fakeThread = threads.GetThread("");
            return(new MessagesBuilderCallback(threads, fakeThread));
        }
Пример #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="BaseRunTests"/> class.
        /// </summary>
        /// <param name="requestData">Provides services and data for execution</param>
        /// <param name="package">The user input test source(package) list if it differs from actual test source otherwise null.</param>
        /// <param name="runSettings">The run settings.</param>
        /// <param name="testExecutionContext">The test execution context.</param>
        /// <param name="testCaseEventsHandler">The test case events handler.</param>
        /// <param name="testRunEventsHandler">The test run events handler.</param>
        /// <param name="testPlatformEventSource">Test platform event source.</param>
        /// <param name="testEventsPublisher">Publisher for test events.</param>
        /// <param name="platformThread">Platform Thread.</param>
        /// <param name="dataSerializer">Data Serializer for cloning TestCase and test results object.</param>
        protected BaseRunTests(
            IRequestData requestData,
            string package,
            string runSettings,
            TestExecutionContext testExecutionContext,
            ITestCaseEventsHandler testCaseEventsHandler,
            ITestRunEventsHandler testRunEventsHandler,
            ITestPlatformEventSource testPlatformEventSource,
            ITestEventsPublisher testEventsPublisher,
            IThread platformThread,
            IDataSerializer dataSerializer)
        {
            this.package               = package;
            this.runSettings           = runSettings;
            this.testExecutionContext  = testExecutionContext;
            this.testCaseEventsHandler = testCaseEventsHandler;
            this.testRunEventsHandler  = testRunEventsHandler;
            this.requestData           = requestData;

            this.isCancellationRequested = false;
            this.testPlatformEventSource = testPlatformEventSource;
            this.testEventsPublisher     = testEventsPublisher;
            this.platformThread          = platformThread;
            this.dataSerializer          = dataSerializer;
            this.SetContext();
        }
 private void MessageProvider_ThreadReceived(object sender, IThread e)
 {
     if (!string.IsNullOrEmpty(e.Ticket))
     {
         _ticket = e.Ticket;
     }
 }
Пример #5
0
        /// <summary>
        /// Gets the message template unique identifier for the specified <see cref="ICommentEvent"/> event.
        /// </summary>
        /// <param name="event">The event.</param>
        protected override Guid GetMessageTemplateId(ICommentEvent @event)
        {
            IComment comment = @event.Item;

            ICommentService cs     = SystemManager.GetCommentsService();
            IThread         thread = cs.GetThread(comment.ThreadKey);

            var  ns = SystemManager.GetNotificationService();
            Guid messageTemplateId;

            if (this.IsReviewThread(thread))
            {
                messageTemplateId = ns.GetMessageTemplates(this.ServiceContext, null)
                                    .Where(mt => mt.Subject == "A new review was posted")
                                    .Select(m => m.Id).FirstOrDefault();
            }
            else
            {
                messageTemplateId = ns.GetMessageTemplates(this.ServiceContext, null)
                                    .Where(mt => mt.Subject == "A new comment was posted")
                                    .Select(m => m.Id).FirstOrDefault();
            }

            if (messageTemplateId == Guid.Empty)
            {
                messageTemplateId = base.GetMessageTemplateId(@event);
            }

            return(messageTemplateId);
        }
Пример #6
0
 public TestableBaseRunTests(
     IRequestData requestData,
     string package,
     string runSettings,
     TestExecutionContext testExecutionContext,
     ITestCaseEventsHandler testCaseEventsHandler,
     ITestRunEventsHandler testRunEventsHandler,
     ITestPlatformEventSource testPlatformEventSource,
     ITestEventsPublisher testEventsPublisher,
     IThread platformThread,
     IDataSerializer dataSerializer)
     : base(
         requestData,
         package,
         runSettings,
         testExecutionContext,
         testCaseEventsHandler,
         testRunEventsHandler,
         testPlatformEventSource,
         testEventsPublisher,
         platformThread,
         dataSerializer)
 {
     this.testCaseEventsHandler = testCaseEventsHandler;
 }
        public ExceptionDialog(IThread thread)
        {
            InitializeComponent();
            this.Icon = _icon;

            _exceptionValue = thread.CurrentException;
            _sourceLocation = thread.GetCurrentSourceRange();

            // no need to hook to UILanguageChanged as this dialog will be closed 
            // before the user gets any chance to update the UI language.
            var _componentMuiIdentifiers = new Dictionary<object, string>()
            {
                {this, "ExceptionDialog.Title"},
                {headerLabel, "ExceptionDialog.ExceptionOccured"},
                {fileLabel, "ExceptionDialog.File"},
                {locationLabel, "ExceptionDialog.Location"},
                {messageLabel, "ExceptionDialog.Message"},
                {closeButton, "ExceptionDialog.Close"},
                {goToFileButton, "ExceptionDialog.GoToFile"},
                {detailsButton, "ExceptionDialog.Details"},
            };
            
            DebuggerBase.Instance.MuiProcessor.ApplyLanguageOnComponents(_componentMuiIdentifiers);

            fileTextBox.Text = _sourceLocation.FilePath.FullPath;
            locationTextBox.Text = DebuggerBase.Instance.MuiProcessor.GetString("ExceptionDialog.LocationFormat",
                "line=" + _sourceLocation.Line,
                "column=" + _sourceLocation.Column);
            messageTextBox.Text = _exceptionValue.ValueAsString(thread);
        }
Пример #8
0
 /// <inheritdoc />
 public IDispatcher FromThread(IThread thread)
 {
     var wrap = (thread as ThreadWrap);
     if (wrap == null) throw new ArgumentException("Thread should wrap CLR thread","thread");
     var real = ((IWrap<Thread>) wrap).UnderlyingObject;
     return new DispatcherWrap(Dispatcher.FromThread(real));
 }
Пример #9
0
 public ProcessInformation(IntPtr processHandle, int processId, IntPtr threadHandle, int threadId)
 {
     _process = new Process(new ProcessHandle(processHandle));
     _processId = processId;
     _thread = new Thread(new ThreadHandle(threadHandle));
     _threadId = threadId;
 }
Пример #10
0
        public int AddActorToThread(string threadName, IActor actor)
        {
            IThread thread  = _data.FindThreadByName(threadName);
            int     actorId = _data.AllocateActor(thread);

            thread.AddActor(actorId, actor);
            return(actorId);
        }
Пример #11
0
        public int AddActor(IActor actor)
        {
            IThread thread  = _data.GetRandomThread();
            int     actorId = _data.AllocateActor(thread);

            thread.AddActor(actorId, actor);
            return(actorId);
        }
Пример #12
0
 public static void closeApplication()
 {
     if (_thread == null)
     {
         _thread = DependencyService.Get <IThread>();
     }
     _thread.closeApplication();
 }
Пример #13
0
 public ThreadPropertiesForm(IThread thread, IPresentersFacade handler, IColorTheme theme)
 {
     this.thread  = thread;
     this.handler = handler;
     this.theme   = theme;
     InitializeComponent();
     UpdateView();
 }
 protected bool IsThreadEqual(IThread left, IThread right)
 {
     if (left is null || right is null)
     {
         return(left == right);
     }
     return(left == right);
 }
Пример #15
0
 void IPresentersFacade.ShowThread(IThread thread)
 {
     mainFormPresenter.ActivateTab(MainForm.TabIDs.Threads);
     if (threadsListPresenter != null)
     {
         threadsListPresenter.Select(thread);
     }
 }
Пример #16
0
 public SearchController(UserManager <LoginUser> userManager, IChannel channelService, IThread threadService, IApplicationUsers userService, IAlbum albumService)
 {
     _userManager    = userManager;
     _channelService = channelService;
     _threadService  = threadService;
     _userService    = userService;
     _albumService   = albumService;
 }
Пример #17
0
 public static void RunOnUiThread(Action acao)
 {
     if (_thread == null)
     {
         _thread = DependencyService.Get <IThread>();
     }
     _thread.RunOnUiThread(acao);
 }
Пример #18
0
 protected override void HandleThreadEnded(IThread t)
 {
     da.Protocol.SendEvent(new ThreadEvent()
     {
         Reason   = ThreadEvent.ReasonValue.Exited,
         ThreadId = ((VSCodeThread)t).Thread.Id
     });
 }
Пример #19
0
 internal ConnectionHandler(ILogger logger, IDateTime dateTime, IThread thread, INetClientProxy netClient, int millisecondsReconnectTime)
 {
     _logger    = logger;
     _dateTime  = dateTime;
     _thread    = thread;
     _netClient = netClient;
     _millisecondsReconnectTime = millisecondsReconnectTime;
 }
Пример #20
0
 bool MatchesThreadInternal(IThread thread)
 {
     if (MatchesAllSourcesInternal())
     {
         throw new InvalidOperationException("This target matches all sources. Checking for single thread is not allowed.");
     }
     return(includeAllFromThreads.Contains(thread));
 }
Пример #21
0
        /// <summary>
        /// Thread要求を構築する
        /// </summary>
        /// <param name="threadInfo"></param>
        /// <param name="dmcInfo"></param>
        /// <param name="option"></param>
        /// <returns></returns>
        private async Task <IAttemptResult <Request::Thread> > GetThreadAsync(IThread threadInfo, IDmcInfo dmcInfo, ICommentFetchOption option)
        {
            var thread = new Request::Thread()
            {
                ThreadNo   = threadInfo.ID.ToString(),
                UserID     = dmcInfo.UserId,
                Fork       = threadInfo.Fork,
                Language   = 0,
                WithGlobal = 1,
                Scores     = 1,
                Nicoru     = 3,
                Force184   = threadInfo.Is184Forced ? "1" : null,
            };

            //投コメを判定
            if (threadInfo.IsOwnerThread)
            {
                thread.ResFrom = -1000;
                thread.Version = "20061206";
            }
            else
            {
                thread.Version = "20090904";
            }

            //Force184?
            if (threadInfo.Is184Forced)
            {
                thread.Force184 = "1";
            }


            //公式動画を判別
            if (threadInfo.IsThreadkeyRequired)
            {
                thread.ThreadKey = threadInfo.Threadkey;
            }
            else
            {
                thread.UserKey = dmcInfo.Userkey;
            }

            //過去ログ
            if (option.DownloadLog)
            {
                IAttemptResult <WayBackKey> wResult = await this._officialCommentHandler.GetWayBackKeyAsync(threadInfo.ID.ToString());

                if (!wResult.IsSucceeded || wResult.Data is null)
                {
                    return(AttemptResult <Request::Thread> .Fail(wResult.Message));
                }

                thread.When       = option.When;
                thread.WayBackKey = wResult.Data.Key;
            }

            return(AttemptResult <Request::Thread> .Succeeded(thread));
        }
Пример #22
0
 public HomeController(ILogger <HomeController> logger,
                       IThread thread,
                       IAchievement achievementService,
                       UserManager <LoginUser> userManager)
 {
     _threadService      = thread;
     _achievementService = achievementService;
     _userManager        = userManager;
 }
Пример #23
0
 public VideoRouter(
     IThread signallingThread,
     PeerConnectionFactory peerConnectionFactory)
 {
     _signallingThread = signallingThread
                         ?? throw new ArgumentNullException(nameof(signallingThread));
     PeerConnectionFactory = peerConnectionFactory
                             ?? throw new ArgumentNullException(nameof(peerConnectionFactory));
 }
Пример #24
0
 protected override void HandleStepCompelte(IThread bpThread)
 {
     da.Protocol.SendEvent(new StoppedEvent()
     {
         AllThreadsStopped = true,
         Reason            = StoppedEvent.ReasonValue.Step,
         ThreadId          = bpThread.ThreadID,
     });
 }
Пример #25
0
        private IEnumerable <IThread> CreateThreads(int threadCount)
        {
            for (int i = 0; i < threadCount; i++)
            {
                IThread thread = _factory.Create();

                yield return(thread);
            }
        }
Пример #26
0
 public IndexReader(ITetriSettings settings, IThread thread, ITagsService tagService, ILogger <IIndexReader> logger, IFileSystem fileSystem, IHashService hashService)
 {
     _settings    = settings;
     _tagService  = tagService;
     _logger      = logger;
     _fileSystem  = fileSystem;
     _hashService = hashService;
     _thread      = thread;
 }
Пример #27
0
        public ThreadTask(IThread Instance)
        {
            this.Instance = Instance;

            Source = new CancellationTokenSource();
            Token  = Source.Token;

            RealThread = new Task(Run, Token, TaskCreationOptions.LongRunning);
        }
 /// <summary>
 /// Allows hosts to set the initial current thread
 /// </summary>
 /// <param name="thread"></param>
 public virtual void SetCurrentThread(IThread thread)
 {
     if (!IsThreadEqual(thread, _currentThread))
     {
         _currentThread = thread;
         ServiceProvider.FlushServices();
         OnContextChange.Fire();
     }
 }
 public MessageReceiverWorkerThread(
     IReceiveFromEndpoints receiverQueue,
     Func <IRouteMessagesToHandlers> routerFactory,
     Func <Action, IThread> thread)
 {
     this.receiverQueue = receiverQueue;
     this.routerFactory = routerFactory;
     this.thread        = thread(this.StartReceiving);
 }
Пример #30
0
        public void RemoveActor(int actorId)
        {
            IThread thread = _data.DeallocateActor(actorId);

            if (thread != null)
            {
                thread.RemoveActor(actorId);
            }
        }
Пример #31
0
        private void UpdateThreadItem(ListViewItem item, IThread currentThread)
        {
            var thread = item.Tag as IThread;

            item.SubItems[0].Text = thread.Handle.ToString();
            item.SubItems[1].Text = thread.Id.ToString();
            item.SubItems[2].Text = ThreadStateAsString(thread.State);
            item.ImageIndex       = currentThread == thread ? 1 : 0;
        }
        public MessageReceiverWorkerThread(
			IReceiveFromEndpoints receiverQueue,
			Func<IRouteMessagesToHandlers> routerFactory,
			Func<Action, IThread> thread)
        {
            this.receiverQueue = receiverQueue;
            this.routerFactory = routerFactory;
            this.thread = thread(this.StartReceiving);
        }
Пример #33
0
        public static void Stop(IThread thread)
        {
            if (!thread.Running)
            {
                return;
            }

            thread.Locked = false;
        }
Пример #34
0
 public void StopPoolWithThreadThatHasStarted()
 {
     using (var pool = new ThreadPool(syncObjectsFactory))
     {
         IThread thread = pool.CreateThread(t => { });
         thread.Start();
         pool.StopAllThreads(new ThreadPoolStopSettings());
     }
 }
Пример #35
0
        public void UpdateControl(IThread currentThread)
        {
            if (currentThread == null)
            {
                listView1.Items.Clear();
                return;
            }

            UpdateList(currentThread);
        }
        public void UpdateControl(IThread currentThread)
        {
            if (currentThread == null)
            {
                listView1.Items.Clear();
                return;
            }

            UpdateList(currentThread);
        }
		public void Dispose()
		{
			ShutdownConsole();
			
			if (thread != null) {
				if (thread.Join(100)) {
					thread = null;
					IsRunning = false;
				}
			}
		}
Пример #38
0
 public Once(OncePool nOncePool)
 {
     mLock = new object();
     mRunning = false;
     mOncePool = nOncePool;
     mRunnable = null;
     PlatformSingleton platformSingleton_ = __singleton<PlatformSingleton>._instance();
     mThread = platformSingleton_._createThread();
     mThread.m_tRunSlot += _runOnce;
     mThread._startRun();
 }
Пример #39
0
        public int AllocateActor(IThread thread)
        {
            lock (_lock)
            {
                int actorId = _nextActorId;
                _nextActorId++;

                _actorsToThreads.Add(actorId, thread);
                return actorId;
            }
        }
Пример #40
0
        public WorkerPoolWorker(
            int ordinal,
            IThreadFactory threadFactory,
            BlockingCollection<IDelivery> deliveries,
            IDeliveryProcessor connectedProcessor)
            : base(connectedProcessor)
        {
            this.ordinal = ordinal;
            this.deliveries = deliveries;

            thread = threadFactory.Create(StartTakingMessages);
        }
        private bool IsReviewThread(IThread thread)
        {
            var isReview = false;

            if (thread.Behavior == null)
            {
                isReview = thread.Key.EndsWith("_review", StringComparison.Ordinal);
            }
            else
            {
                isReview = thread.Behavior == "review";
            }

            return isReview;
        }
Пример #42
0
 public override void Execute(IThread thread)
 {
     thread.Syscall (thread.Regs.IntRegs[2]);
 }
Пример #43
0
        public override void Execute(IThread thread)
        {
            uint addr = (uint)(thread.Regs.IntRegs[this[BitField.RS]] + this.Displacement);

            uint ea = addr & ~3u;
            uint byte_offset = addr & 3;

            uint mem = thread.Mem.ReadWord(ea);
            uint reg_shift = 8 * byte_offset;

            mem = thread.Regs.IntRegs[this[BitField.RT]] << (int)reg_shift | (mem & (BitHelper.Mask ((int)reg_shift)));

            thread.Mem.WriteWord (ea, mem);
        }
Пример #44
0
 public override uint Ea(IThread thread)
 {
     uint addr = (uint)(thread.Regs.IntRegs[this[BitField.RS]] + this.Displacement);
     uint ea = addr & ~3u;
     return ea;
 }
Пример #45
0
 public override void Execute(IThread thread)
 {
     uint ft = thread.Regs.FloatRegs.GetUint (this[BitField.FT]);
     thread.Mem.WriteWord (this.Ea (thread), ft);
 }
Пример #46
0
 public override void Execute(IThread thread)
 {
     thread.Regs.IntRegs[this[BitField.RT]] = (uint)thread.Regs.IntRegs[this[BitField.RS]] < this.ZextImm ? 1u : 0;
 }
Пример #47
0
 public override void Execute(IThread thread)
 {
     thread.Regs.IntRegs[this[BitField.RT]] = thread.Regs.IntRegs[this[BitField.RS]] ^ this.ZextImm;
 }
Пример #48
0
 public override void Execute(IThread thread)
 {
     thread.Regs.IntRegs[this[BitField.RD]] = (uint)((int)thread.Regs.IntRegs[this[BitField.RS]] - (int)thread.Regs.IntRegs[this[BitField.RT]]);
 }
Пример #49
0
 public override void Execute(IThread thread)
 {
     thread.Regs.IntRegs[this[BitField.RD]] = (uint)((int)thread.Regs.IntRegs[this[BitField.RS]] - (int)thread.Regs.IntRegs[this[BitField.RT]]);
     Logger.Warn (Logger.Categories.Instruction, "Sub: overflow trap not implemented.");
 }
Пример #50
0
 public override void Execute(IThread thread)
 {
     thread.Regs.IntRegs[this[BitField.RD]] = (uint)thread.Regs.IntRegs[this[BitField.RT]] >> (int)BitHelper.Bits (thread.Regs.IntRegs[this[BitField.RS]], 4, 0);
 }
Пример #51
0
 public override void Execute(IThread thread)
 {
     thread.Regs.IntRegs[this[BitField.RD]] = (uint)thread.Regs.IntRegs[this[BitField.RT]] >> (int)this[BitField.SA];
 }
Пример #52
0
        public override void Execute(IThread thread)
        {
            float fs = thread.Regs.FloatRegs.GetFloat (this[BitField.FS]);

            float fd = (float)Math.Sqrt (fs);

            thread.Regs.FloatRegs.SetFloat (fd, this[BitField.FD]);
        }
Пример #53
0
        public override void Execute(IThread thread)
        {
            double fs = thread.Regs.FloatRegs.GetDouble (this[BitField.FS]);

            double fd = Math.Sqrt (fs);

            thread.Regs.FloatRegs.SetDouble (fd, this[BitField.FD]);
        }
Пример #54
0
 public override void Execute(IThread thread)
 {
     Logger.Panicf (Logger.Categories.Instruction, "Unimplemented instruction [machineInstruction: 0x{0:x8}, mnemonic: \"{1:s}] detected @ PC 0x{2:x8}", this.MachineInstruction.Data, this.Mnemonic, thread.Regs.Pc);
 }
Пример #55
0
 public override void Execute(IThread thread)
 {
     Logger.Panicf (Logger.Categories.Instruction, "{0:s} detected @ PC 0x{1:x8}", "Unknown instruction", thread.Regs.Pc);
 }
Пример #56
0
        public override void Execute(IThread thread)
        {
            double fs = thread.Regs.FloatRegs.GetDouble (this[BitField.FS]);
            double ft = thread.Regs.FloatRegs.GetDouble (this[BitField.FT]);

            double fd = fs - ft;

            thread.Regs.FloatRegs.SetDouble (fd, this[BitField.FD]);
        }
Пример #57
0
 public override void Execute(IThread thread)
 {
     ushort mem = (ushort)BitHelper.Bits (thread.Regs.IntRegs[this[BitField.RT]], 15, 0);
     thread.Mem.WriteHalfWord (this.Ea (thread), mem);
 }
Пример #58
0
        public override void Execute(IThread thread)
        {
            float fs = thread.Regs.FloatRegs.GetFloat (this[BitField.FS]);
            float ft = thread.Regs.FloatRegs.GetFloat (this[BitField.FT]);

            float fd = fs - ft;

            thread.Regs.FloatRegs.SetFloat (fd, this[BitField.FD]);
        }
Пример #59
0
 public override void Execute(IThread thread)
 {
     uint mem = thread.Regs.IntRegs[this[BitField.RT]];
     thread.Mem.WriteWord (this.Ea (thread), mem);
 }
Пример #60
0
 public override void Execute(IThread thread)
 {
     thread.Regs.IntRegs[this[BitField.RD]] = (int)thread.Regs.IntRegs[this[BitField.RS]] < (int)thread.Regs.IntRegs[this[BitField.RT]] ? 1u : 0;
 }