Questions tagged [event-wait-handle]
51 questions
1
vote
1 answer
AutoResetEvent Set called after timeout
From MSDN "If there are no waiting threads, the wait handle remains signaled until a thread attempts to wait on it, or until its Reset method is called."
EventWaitHandle MyWaitHandle = new AutoResetEvent(false);
Thread # 1:
public void Method1()
{
…

user1178376
- 928
- 2
- 10
- 24
1
vote
1 answer
Does ManualResetEventSlim signaling degrades performance?
I am using ManualResetEventSlim to have signaling mechanism in my application and It works great if requests/sec are 100. As I increase request/sec, it gets worse.
Example:
100 Requests/sec -> 90% transaction done in 250 ms and Throughput (Success…

Muqadar Ali
- 87
- 11
1
vote
2 answers
Scheduling with EventWaitHandle with Dispatcher.BeginInvoke
The following piece of code has two threads each writing 20's string str to its corresponding textbox. Once completed, Thread t00 signals Thread t01 to start and change the shared string str from y to x. Thread t00 should write 20 y to a textbox,…

KMC
- 19,548
- 58
- 164
- 253
1
vote
0 answers
Using EventWaitHandle to ensure a single instance application with notifications
What is the correct way to set up the EventWaitHandleSecurity in the following sample that uses EventWaitHandle to ensure a single instance application?
///
/// The method either:
/// 1) acquires mutex and starts listing if…

Ilya Gerasimets
- 46
- 4
1
vote
2 answers
EventWaitHandle sometimes! skip thread
I am using VS 2012, .Net 4.5.
Execute this code (just upgrade some sample from article about threading):
using System.Threading;
class BasicWaitHandle
{
static EventWaitHandle wh = new AutoResetEvent(false);
static void Main()
{
new…

user3190541
- 33
- 1
- 4
1
vote
1 answer
Issue with windows service waiting for a named event, using EventWaitHandle.
I'm currently developing a windows service with c# and .net framework 4.5 to extend the functionality of an existing propietary application, this service blocks on an EventWaitHandleClass (msdn link) waiting for a named event signaled from the main…

George181716
- 23
- 5
1
vote
2 answers
reading and writing file using autoresetevent in C#
I have written a simple program of thread synchronization. But when I run this program I get an error "The process cannot access the file 'D:\Vivek.txt' because it is being used by another process." Why I am getting this error.
class Program
{
…

Vivek Kumar Mishra
- 11
- 1
1
vote
0 answers
WinFormApps vs. ConsoleApps : BackgroundWorker and EventWaitHandle
I have two programs : WinformApplication and ConsoleApplication with .NET 2.0 , C#, and VS2010.
Two programs has same taks with backgroundworker and EventWaitHandle.
Create BGW
DoWork
RunWorkerCompleted { .. event.Set(); .. }
Wait…

Changju.rhee
- 463
- 3
- 11
- 26
1
vote
1 answer
Send event to single process
I am currently using an EventWaitHandle to trigger a clean shutdown of a native process that doesnt have a window from a Windows Forms app. When I have multiple of these processes running at the same time, setting the event will stop all of them. Is…

Malik Drako
- 577
- 1
- 8
- 19
1
vote
2 answers
Proper Way to Stop App While Threads Are Waiting on WaitOne()
I'm playing around with AutoResetEvent and my app isn't ending, and I think I know why: the threads are still running and therefore the app won't terminate. Normally, in Main(), after I press a key, the app terminates. But the console window no…

Bob Horn
- 33,387
- 34
- 113
- 219
1
vote
1 answer
Using EventWaitHandle to ensure a single instance across multiple users
Collaborators have built a prototype using Processing that connects to a Sparkfun RFID reader, I think using a serial connection over USB. We've deployed the prototype into a number of trialists' homes and one common usage scenario I foolishly…

dumbledad
- 16,305
- 23
- 120
- 273
0
votes
0 answers
EventWaitHandle access denied .NET Standard 2.0
I am using a global EventWaitHandle to implement an inter-process handshake for a named pipe. The server (running as service with admin priviliges) opens the EventWaitHandle while the client checks for the open handle before connecting to the named…

00zetti
- 114
- 8
0
votes
0 answers
c# webview2 serialize loadings of a few pages with waithandle
folks. I want to crawl data from a few pages with webview2. I am about to load and extract data from the pages one by one. I wrote some codes but they didn't work. I am stuck. Here are the core codes:
async Task Crawl()
{
AutoResetEvent…

Willi
- 187
- 1
- 1
- 12
0
votes
1 answer
PowerShell CloseHandle on EventWaitHandle
I have two PowerShell scripts. One of them has to wait at the other at one point. Here are the relevant parts:
WaitingScript.ps1:
$StopEventName = 'MyEvent'
function Wait-StopEvent {
$EventResetModeManualReset = 1
$StopEventObject =…

z32a7ul
- 3,695
- 3
- 21
- 45
0
votes
1 answer
EventWaitHandle.Set, wait timeout and number of released threads
From doc (EventWaitHandle.Set)
There is no guarantee that every call to the Set method will release a thread from an EventWaitHandle whose reset mode is EventResetMode.AutoReset. If two calls are too close together, so that the second call occurs…

Yarl
- 728
- 1
- 7
- 26