Questions tagged [manualresetevent]

ManualResetEvent notifies one or more waiting threads that an event has occurred

ManualResetEvent notifies one or more waiting threads that an event has occurred

References

136 questions
0
votes
2 answers

ManualResetEvent wait doesn't release after being set

I'm downloading two JSON files from the webs, after which I want to allow loading two pages, but not before. However, the ManualResetEvent that is required to be set in order to load the page never "fires". Even though I know that it gets set,…
SamiHuutoniemi
  • 1,576
  • 2
  • 16
  • 35
0
votes
3 answers

ManualResetEvent not working; Thread

I have a client which creates a thread. That thread has a WaitOne() so while it is stuck there my client does not die. But when I want to shut down my client, I need to do a Set() on that manual reset event. I declare the manual reset event in the…
AAlferez
  • 1,480
  • 1
  • 22
  • 48
0
votes
1 answer

Why is this synchronization not working?

I have this code: #include #include #include #include #include #define ITERATIONS 10 typedef struct NUMERE { DWORD a; DWORD b; } *PNUMERE; HANDLE ghThreadHandle[2]; HANDLE…
conectionist
  • 2,694
  • 6
  • 28
  • 50
0
votes
0 answers

BackgroundWorker and ManualResetEvent

The task. I have one method which runs two long-time functions inside. Im not talking about locking objects here. These funcs are independent, only have same parameter which used in readonly. I want one func to run inside thread. private static…
Alexander
  • 431
  • 2
  • 5
  • 19
0
votes
1 answer

Using CountdownEvent and ManualResetEvent to control threads in ThreadPool

I've got the following multithreaded code excerpt that I've been working on to compare files following a zipped copy and unzip. The application is zipping a folder containing a variable number of files of various sizes, copying the files to a…
0
votes
1 answer

Problems running method with manual reset event

I am building a method that uses the ManualResetEvent but i can't get it to run after i initiate the WaitOne method. Here is my code of the method. The code runs the code until it runs to the wait.WaitOne() call. Thanks!! var wait = new…
chris
  • 343
  • 4
  • 13
0
votes
1 answer

ManualResetEvent - how might a race condition occur here?

I am trying to determine whether I can use a ManualResetEvent here to ensure that in a concurrent environment, the inner actions of myMethod() are never invoked concurrently. static volatile bool _syncInitialized = false; static…
Sean Thoman
  • 7,429
  • 6
  • 56
  • 103
0
votes
2 answers

Synchronizing Thread and Event

In my console application, Synchronizing the events within in thread makes difficult. using System; using System.Threading; using System.Windows.Forms; namespace ConsoleApplication1 { public class Example { private static Button…
0
votes
2 answers

Is this code [theoretically] thread-unsafe?

I'm experiencing a strange deadlock in the code that I've written. The idea is to implement an asynchronous operation whose Stop is synchronous -- the caller has to wait until it completes. I've simplified the part where real work is done to a…
Kerido
  • 2,930
  • 2
  • 21
  • 34
0
votes
1 answer

Main thread not proceeding when child threads have finished

I am trying to use multithreading in my application. The method test5 tries to fetch some content from Internet, while the main thread waits for all threads to finish before continuing with other work. But my main thread doesn't come back after…
Hami
  • 335
  • 1
  • 7
  • 22
0
votes
1 answer

Passing a ManualResetEvent object between classes

My program contains multiple threads, which I want to use a single ManualResetEvent object to control. When I create a new object (eg. new ManualResetEvent MRE = new ManualResetEvent(args);), I want MRE to be accessible by all classes, yet it is…
Ari
  • 3,489
  • 5
  • 26
  • 47
0
votes
2 answers

Console app exits before callback is executed

I have a console app that executes a class method (in a different project). This method performs a POST to a webservice asynchronously (this is a lengthy operations of 3 minutes) and has a callback that returns the number of records affected by the…
Diego
  • 998
  • 1
  • 11
  • 20
0
votes
1 answer

ManualResetEvent issue on WinXP embedded

I am having a problem with using the ManualResetEvent class with a timeout parameter. This problem occurs specifically on the WinXP embedded platform. The code works perfectly on other windows platforms. I am communicating with a TCP server. In my…
this-Me
  • 2,139
  • 6
  • 43
  • 70
-1
votes
0 answers

Using declaration with ManualResetEvent causes break point at the end of method to be hit twice

To reproduce: create any .NET 7 console project with Visual Studio 2022. Put a breakpoint at the line on the closing bracket. Start debugging, you'll observe the breakpoint being hit. I expect a press of Continue(F5) will run through this line but…
Lionet Chen
  • 832
  • 11
  • 26
-1
votes
1 answer

Wait inside While with ManualResetEvent

I have an operation via While that i want to Freeze: do { ManualResetEvent.Reset(); // Here i want to wait // Here i am doing my stuff... } while (some boolean value); } My ManualResetEvent : private static…
user979033
  • 5,430
  • 7
  • 32
  • 50
1 2 3
9
10