I've only used it a few times.
Basically, it is a little more less primitive lock than the SyncLock
mechnism where the WaitOne enters a queue and waits for the other
thread
to
unlock the variable.
Its defined as this
----
You can use a mutex object to protect a shared resource from simultaneous
access by multiple threads or processes. The state of a mutex object is
either set to signaled, when it is not owned by any thread, or
nonsignaled,
when it is owned. Only one thread at a time can own a mutex object. For
example, to prevent two threads from writing to shared memory at the same
time, each thread waits for ownership of a mutex object before
executing
the
code that accesses the memory. After writing to the shared memory, the
thread releases the mutex object.
----
I could be wrong in my understanding... but seems pretty cut and dry...
now
the WaitOne is the part that gets tricky... Because you have to make sure
your reset the thread signal...
Try this out..it's in C# but easy to understand.
http://msdn.microsoft.com/library/d...y/en-us/csref/html/vcwlkthreadingtutorial.asp
HTH,
CJ
"One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> wrote in
message
Never done that, how does that work ?
--
OHM ( Terry Burns ) * Use the following to email me *
Dim ch() As Char = "ufssz/cvsotAhsfbuTpmvujpotXjui/OFU".ToCharArray()
For i As Int32 = 0 To ch.Length - 1
ch(i) = Convert.ToChar(Convert.ToInt16(ch(i)) - 1)
Next
Process.Start("mailto:" & New String(ch))
--
"CJ Taylor" <[cege] at [tavayn] dit commmmm> wrote in message
What about using a mutex and using WaitOne?
"One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> wrote in
message
Thanks.
Ive got around this by creating a new graphics area for the same
control,
this way writing to it does not conflict and produces not exceptions,
however, Im not sure if this is safe or not.
--
OHM ( Terry Burns ) * Use the following to email me *
Dim ch() As Char = "ufssz/cvsotAhsfbuTpmvujpotXjui/OFU".ToCharArray()
For i As Int32 = 0 To ch.Length - 1
ch(i) = Convert.ToChar(Convert.ToInt16(ch(i)) - 1)
Next
Process.Start("mailto:" & New String(ch))
--
Terry,
The best way is to avoid it and when you absolute cannot than it is
synclock however I suppose you know that so your message should
be
something else.
Cor
"One Handed Man ( OHM - Terry Burns )"
..
Sorry if this gets duplicated, but I posted it and cant see it for
a
long
time so repost. . .
I have an application which is writing to a graphics object, the
main
UI
thread and a worker thread are writing to the same object, whats
the
best
way to manage this ?
Thanks OHM
--
OHM ( Terry Burns ) * Use the following to email me *
Dim ch() As Char =
"ufssz/cvsotAhsfbuTpmvujpotXjui/OFU".ToCharArray()
For i As Int32 = 0 To ch.Length - 1
ch(i) = Convert.ToChar(Convert.ToInt16(ch(i)) - 1)
Next
Process.Start("mailto:" & New String(ch))