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
1
vote
1 answer

How to properly use Async, Await and ManualResetEvents to control an infinite while loop

So what i am trying to do here is: Make the engine loop and work on an object if the queue is not empty. If the queue is empty i call the manualresetevent to make the thread sleep. When a item is added and the loop is not active i set the…
AGCodes
  • 622
  • 1
  • 8
  • 22
1
vote
2 answers

Why does working with two ManualResetEvents cause a deadlock here?

I'm performing an async operation for an upload using Starksoft.Net.Ftp. Looks like that: public void UploadFile(string filePath, string packageVersion) { _uploadFtpClient= new FtpClient(Host, Port, FtpSecurityProtocol.None) …
Dominic B.
  • 1,897
  • 1
  • 16
  • 31
1
vote
1 answer

ManualResetEvent.WaitOne stuck the GUI

I have a Timer that does several things private System.Threading.Timer _xTimer = new System.Threading.Timer(new TimerCallback(XTimerHandler), null, 0, _xTimerPollingInterval); private void XTimerHandler(object param) { //some code. } I have a…
Hodaya Shalom
  • 4,327
  • 12
  • 57
  • 111
1
vote
0 answers

Functionality of ManualResetEvent.WaitOne with 0 time out argument

I was dealing with code that has some calls to ManualResetEvent's WaitOne call. From the MSDN documentation, If timeout is zero, the method does not block. It tests the state of the wait handle and returns immediately. Now, this is my piece of…
Cygnus
  • 3,222
  • 9
  • 35
  • 65
1
vote
1 answer

concurrent select from named pipe

Say i have a fifo (named pipe) which gets open multiple times from multiple processes or threads. All of them will call select() for read concurrently. If a writer comes in and writes, say one byte to this fifo, will all blocked select() calls…
Yevgeniy P
  • 1,480
  • 1
  • 15
  • 23
1
vote
2 answers

.NET - ManualResetEvent.Reset thread blocking

According to MSDN, the purpose of ManualResetEvent's Reset() method is - Sets the state of the event to nonsignaled, causing threads to block. What thread(s) does it block ? The calling thread or the current one or any other ? Thanks in advance.
Cygnus
  • 3,222
  • 9
  • 35
  • 65
1
vote
2 answers

synchronously invoke client side method with SignalR

SignalR does not have the ability to have client methods which returns a value. So I am trying to create a helper class to make this possible. So this is what I am trying to do: Server side: Call client method and provide unique request id…
hwcverwe
  • 5,287
  • 7
  • 35
  • 63
1
vote
1 answer

Blocking in a background thread in Windows Phone 8

I am working with Windows Phone's Coding4Fun toolkit's MessagePrompt object. I want to display the MessagePrompt and then block or wait until the MessagePrompt's Completed event fires. I obviously want to do this in a background thread as I don't…
1
vote
0 answers

Synchronous Call in Windows Phone 7

I know that I cannot make a true synchronous call in Windows Phone 7. However, I'm trying to at least block the threads from processing until the async call is made or there is a timeout. I've tried the following, but it seems like my app just…
1
vote
1 answer

How to implement Pause & Resume functionality with BackgroundWorker c#

i want to implement pause resume and cancel functionality with BackgroundWorker. i have a one user control and all backgroundworker related code written in user control. i just add user control on flow layout control as many as time user click on…
Thomas
  • 33,544
  • 126
  • 357
  • 626
1
vote
2 answers

Static variables generating problems with C# (Windows 8)

I am not a used C# programmer, so if this is stupid, sorry :-) I am developing a C# app for Windows 8. I need to do a web request, and therefore, I have a callback to handle the request data. I am using the standard approach: private static…
Alberto
  • 499
  • 4
  • 23
1
vote
1 answer

How to properly stop single threaded windows service (onStop)?

I have got a windows service written in VS 2010 / .NET 4.0. The service is following the scheme of the code snippet below: Using a timer, it executes some desired behaviour every couple of minutes. The requirement for the "desired behaviour" that's…
ManOnAMission
  • 1,023
  • 1
  • 12
  • 31
1
vote
1 answer

ManualResetEvent with HttpWebRequest on WP7

To start off with, this might be tagged as a duplicate of the following thread: Wait for HttpWebRequest.BeginGetResponse to finish in Windows Phone 7, however, the responses in that thread did not help me get over my problem. To begin with, I am…
Arun S
  • 11
  • 1
0
votes
2 answers

Is ManualResetEvent size checking sufficient for waiting for multiple thread?

I am currently using the ManualResetEvent for a single thread to wait for multiple thread to add something to the queue of a thread manager. If the thread manager receives a signal using manual reset event, it will dequeue the added item and do…
Nap
  • 8,096
  • 13
  • 74
  • 117
0
votes
2 answers

Is this Background Thread Queue a performant implementation?

Specifically, I'm wondering: Will the ManualResetEvent consume resources while it is in a wait state? Does the performance degradation of context switching apply to threads that are in a wait state? If I have a choice to use multiple…
Eric Dahlvang
  • 8,252
  • 4
  • 29
  • 50