What is a synchronization domain?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Can anyone tell me what is a synchronization domain? Or you can also direct
me to a good article.

<quote_from_msdn>
Waits for any of the elements in the specified array to receive a signal,
using a 32-bit signed integer to measure the time interval, and specifying
whether to exit the synchronization domain before the wait.

[Visual Basic]
Overloads Public Shared Function WaitAny( _
ByVal waitHandles() As WaitHandle, _
ByVal millisecondsTimeout As Integer, _
ByVal exitContext As Boolean _
) As Integer

[C#]
public static int WaitAny(
WaitHandle[] waitHandles,
int millisecondsTimeout,
bool exitContext
);

Parameters
waitHandles
A WaitHandle array containing the objects for which the current instance
will wait.
millisecondsTimeout
The number of milliseconds to wait, or Timeout.Infinite (-1) to wait
indefinitely.
exitContext
true to exit the synchronization domain for the context before the wait (if
in a synchronized context), and reacquire it; otherwise, false.
</quote_from_msdn>
 
if you aquired synchonization lock, the flag indicates whether to release
that lock before waiting.


Leonid Finis.




Lionel LASKE said:
My guess is that "domain" is for ".NET application domain".
See more on http://www.gotdotnet.com/team/clr/AppdomainFAQ.aspx

Lionel.


Neo The One said:
Can anyone tell me what is a synchronization domain? Or you can also
direct
me to a good article.

<quote_from_msdn>
Waits for any of the elements in the specified array to receive a signal,
using a 32-bit signed integer to measure the time interval, and
specifying
whether to exit the synchronization domain before the wait.

[Visual Basic]
Overloads Public Shared Function WaitAny( _
ByVal waitHandles() As WaitHandle, _
ByVal millisecondsTimeout As Integer, _
ByVal exitContext As Boolean _
) As Integer

[C#]
public static int WaitAny(
WaitHandle[] waitHandles,
int millisecondsTimeout,
bool exitContext
);

Parameters
waitHandles
A WaitHandle array containing the objects for which the current instance
will wait.
millisecondsTimeout
The number of milliseconds to wait, or Timeout.Infinite (-1) to wait
indefinitely.
exitContext
true to exit the synchronization domain for the context before the wait
(if
in a synchronized context), and reacquire it; otherwise, false.
</quote_from_msdn>
 
Then how do you explain "to exit the synchronization domain before the wait"?

Why before?

Leonid Finis said:
if you aquired synchonization lock, the flag indicates whether to release
that lock before waiting.


Leonid Finis.




Lionel LASKE said:
My guess is that "domain" is for ".NET application domain".
See more on http://www.gotdotnet.com/team/clr/AppdomainFAQ.aspx

Lionel.


Neo The One said:
Can anyone tell me what is a synchronization domain? Or you can also
direct
me to a good article.

<quote_from_msdn>
Waits for any of the elements in the specified array to receive a signal,
using a 32-bit signed integer to measure the time interval, and
specifying
whether to exit the synchronization domain before the wait.

[Visual Basic]
Overloads Public Shared Function WaitAny( _
ByVal waitHandles() As WaitHandle, _
ByVal millisecondsTimeout As Integer, _
ByVal exitContext As Boolean _
) As Integer

[C#]
public static int WaitAny(
WaitHandle[] waitHandles,
int millisecondsTimeout,
bool exitContext
);

Parameters
waitHandles
A WaitHandle array containing the objects for which the current instance
will wait.
millisecondsTimeout
The number of milliseconds to wait, or Timeout.Infinite (-1) to wait
indefinitely.
exitContext
true to exit the synchronization domain for the context before the wait
(if
in a synchronized context), and reacquire it; otherwise, false.
</quote_from_msdn>
 
Then how do you explain "to exit the synchronization domain before the wait"?

Why before?



Leonid Finis said:
if you aquired synchonization lock, the flag indicates whether to release
that lock before waiting.


Leonid Finis.




Lionel LASKE said:
My guess is that "domain" is for ".NET application domain".
See more on http://www.gotdotnet.com/team/clr/AppdomainFAQ.aspx

Lionel.


Neo The One said:
Can anyone tell me what is a synchronization domain? Or you can also
direct
me to a good article.

<quote_from_msdn>
Waits for any of the elements in the specified array to receive a signal,
using a 32-bit signed integer to measure the time interval, and
specifying
whether to exit the synchronization domain before the wait.

[Visual Basic]
Overloads Public Shared Function WaitAny( _
ByVal waitHandles() As WaitHandle, _
ByVal millisecondsTimeout As Integer, _
ByVal exitContext As Boolean _
) As Integer

[C#]
public static int WaitAny(
WaitHandle[] waitHandles,
int millisecondsTimeout,
bool exitContext
);

Parameters
waitHandles
A WaitHandle array containing the objects for which the current instance
will wait.
millisecondsTimeout
The number of milliseconds to wait, or Timeout.Infinite (-1) to wait
indefinitely.
exitContext
true to exit the synchronization domain for the context before the wait
(if
in a synchronized context), and reacquire it; otherwise, false.
</quote_from_msdn>
 
Then how do you explain "to exit the synchronization domain before the
wait"?

Why before?

I've always been a bit confused by the terminology too. Does
synchronization domain mean release all the locks, or only the most nested
lock?

I've never used this feature, but I am pretty sure it's there to help you
prevent a deadlock situation. If you release the lock and reacquire it
before waiting you give other threads waiting on the lock a chance to
continue.

What I've never understood is how this could possibly be a part of a good
design. It seems like a very kludgey thing to do. Would someone care to
enlighten us all?
 
It doesn't make sense to hold the lock during the wait and then release
it after the wait has completed when the thread begins executing code
again.
 
Back
Top