private void DbListener() { bool isConnected = TryConnectSocket(); bool isNeedSendEventsAgain = false; bool isNeedSendExceptionsAgain = false; while (true) { ewh.WaitOne(); System.Threading.Thread.Sleep(1500); if (_isEventsRecord) { ewh.Reset(); continue; } if (isConnected) { isNeedSendEventsAgain = _context.SendTrackerEvents(socket, ref isConnected); isNeedSendExceptionsAgain = _context.SendExceptions(socket, ref isConnected); if (!isNeedSendEventsAgain && !isNeedSendExceptionsAgain) { ewh.Reset(); } } else { isConnected = TryConnectSocket(); if (!isConnected) { System.Threading.Thread.Sleep(1000); } } } }
private void _execute() { System.Threading.Thread t = new System.Threading.Thread(executeThread); executeEvent.Reset(); t.Start(); executeEvent.WaitOne(System.Threading.Timeout.Infinite); }
public async Task Process() { while (!Error) { if (msgQueue.Count == 0) { waitHandle.WaitOne(); } try { var folderList = StorageApplicationPermissions.FutureAccessList; if (LogFile == null && Config.GetBoolean(Config.EnableLogs) && folderList.ContainsItem(Config.LogsFolder)) { var parent = await StorageApplicationPermissions.FutureAccessList.GetFolderAsync(Config.LogsFolder); serverFolder = await parent.CreateFolderAsync(server, CreationCollisionOption.OpenIfExists); currentDate = DateTime.Now.ToString("yyyy-MM-dd"); await OpenFile(); } else if (LogFile != null) { var newDate = DateTime.Now.ToString("yyyy-MM-dd"); if (newDate != currentDate) { currentDate = newDate; await OpenFile(); } Message msg; msgQueue.TryDequeue(out msg); if (msg != null) { await WriteLine(MessageToString(msg)); } } else { Error = true; break; } } catch (Exception e) { Error = true; Message error = new Message() { User = "******", Type = MessageType.Info, Text = e.Message + "\r\n Logging disabled for this channel" }; msgs.Add(error); } waitHandle.Reset(); } }
public override bool Execute() { System.Threading.EventWaitHandle handle = new System.Threading.EventWaitHandle( true, System.Threading.EventResetMode.AutoReset, m_Name); if (m_Lock) { handle.WaitOne(); handle.Reset(); } else { handle.Set(); } return true; }
public override bool Execute() { System.Threading.EventWaitHandle handle = new System.Threading.EventWaitHandle( true, System.Threading.EventResetMode.AutoReset, m_Name); if (m_Lock) { handle.WaitOne(); handle.Reset(); } else { handle.Set(); } return(true); }
/// <summary> /// Set the current command or reset it to none /// </summary> /// <param name="eCmd"> Command</param> /// <param name="gameIntf"> Associated game interface if any</param> public void SetCommand(CmdExecutingE eCmd, GameIntf gameIntf) { if (eCmd == CmdExecutingE.None) { throw new ArgumentException("Use ResetCommand to set a command to none"); } lock (this) { if (CmdExecuting != CmdExecutingE.None && CmdExecuting != CmdExecutingE.PreLogin) { throw new MethodAccessException("Cannot execute a command while another is executing"); } CmdExecuting = eCmd; TimeStarted = DateTime.Now; CurrentGameIntf = gameIntf; Phase = 0; LastCmdError = null; CmdSignal.Reset(); } }
private void FindUserLocation() { //Task.Run(async () => //{ Timer locationTimer = new Timer(); locationTimer.Interval = DESIRED_SECONDS * 1000; locationTimer.Elapsed += async(o, e) => { waitHandle.Reset(); //Task.Run(async () => //{ var locator = CrossGeolocator.Current; Plugin.Geolocator.Abstractions.Position position = await locator.GetPositionAsync(TimeSpan.FromSeconds(DESIRED_SECONDS)); myLocation = new SheredClasses.Point(position.Latitude, position.Longitude); waitHandle.Set(); //}); }; locationTimer.Start(); //timeOfLocation = DateTime.Now; //}); }
private static void SignalEvent() { EV.Set(); System.Threading.Thread.Sleep(500); EV.Reset(); }
void SearchServiceSearchStarted() { searchFinishedEvent.Reset(); ongoingSearches++; }
internal void Reset() { ev.Reset(); notified = false; }
private static void SignalEvent() { EV.Set(); //setta l'evento System.Threading.Thread.Sleep(500); //aspetta 500ms così da assicurarsi che tutti lo vedano EV.Reset(); //resetta l'evento }