AutoResetEvent doesn't guarentee order

  • Thread starter Thread starter Joris Dobbelsteen
  • Start date Start date
J

Joris Dobbelsteen

Is it correct that the AutoResetEvent class doesn't guareentee any ordering?

- Joris
 
Joris,

Yes, this is correct. The order in which the threads are released is
not able to be set, or guaranteed.

You should use this as a filter of sorts, not as an ordering mechanism.
If you need an ordering mechanism, then you should have a controller on a
thread which will block the other threads (it passes out the handles to wait
on, so that they are unique), and then have that wait on the one event.
When it is released, it releases one more thread.

Hope this helps.
 
Too bad, I basically because a problem because a few threads continues get
the event and the other ones are waiting till they time out...
I would expect that muxes will work the same.

Is there a limitation to the number of WaitHandles that can be created under
..NET? Or perhaps a very long setup time?

- Joris

Nicholas Paldino said:
Joris,

Yes, this is correct. The order in which the threads are released is
not able to be set, or guaranteed.

You should use this as a filter of sorts, not as an ordering mechanism.
If you need an ordering mechanism, then you should have a controller on a
thread which will block the other threads (it passes out the handles to wait
on, so that they are unique), and then have that wait on the one event.
When it is released, it releases one more thread.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Joris Dobbelsteen said:
Is it correct that the AutoResetEvent class doesn't guareentee any ordering?

- Joris
 
Joris,

I imagine that the upper limit on these things is very high. Just how
many are you planning on creating?


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Joris Dobbelsteen said:
Too bad, I basically because a problem because a few threads continues get
the event and the other ones are waiting till they time out...
I would expect that muxes will work the same.

Is there a limitation to the number of WaitHandles that can be created under
.NET? Or perhaps a very long setup time?

- Joris

message news:#f#vR#[email protected]...
Joris,

Yes, this is correct. The order in which the threads are released is
not able to be set, or guaranteed.

You should use this as a filter of sorts, not as an ordering mechanism.
If you need an ordering mechanism, then you should have a controller on a
thread which will block the other threads (it passes out the handles to wait
on, so that they are unique), and then have that wait on the one event.
When it is released, it releases one more thread.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Joris Dobbelsteen said:
Is it correct that the AutoResetEvent class doesn't guareentee any ordering?

- Joris
 
Nicholas, I meant to say thanks...

Does anyone know a mechnism simple enough to orderly handle waiting threads
and allowing them to time out?

- Joris
 
Nicholas Paldino said:
Joris,

I imagine that the upper limit on these things is very high. Just how
many are you planning on creating?

Well, basically I'm a bit lost on how to implement synchronization in order
and allow a timeout to occur...

- Joris
--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Joris Dobbelsteen said:
Too bad, I basically because a problem because a few threads continues get
the event and the other ones are waiting till they time out...
I would expect that muxes will work the same.

Is there a limitation to the number of WaitHandles that can be created under
.NET? Or perhaps a very long setup time?

- Joris

message news:#f#vR#[email protected]...
on
a
thread which will block the other threads (it passes out the handles
to
wait
on, so that they are unique), and then have that wait on the one event.
When it is released, it releases one more thread.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

message Is it correct that the AutoResetEvent class doesn't guareentee any
ordering?

- Joris
 
Back
Top