How to manage processes on a shared resource

  • Thread starter Hakan Fatih YILDIRIM
  • Start date
H

Hakan Fatih YILDIRIM

Hi .net gurus,
I wrote a program that writes a text file in a loop and i managed
threads with mutex objects in it.But when i open the same exe again
and execute them together.they lock each other.Is there a way or
sample that i can learn to manage processes on a shared resource? what
are the keywords. I usesd semaphore but i couldn't do what i want .

Thanks
 
C

Charles Calvert

I wrote a program that writes a text file in a loop and i managed
threads with mutex objects in it.But when i open the same exe again
and execute them together.they lock each other.Is there a way or
sample that i can learn to manage processes on a shared resource? what
are the keywords. I usesd semaphore but i couldn't do what i want .

While there may be books about this, there is no substitute for
experience.

It sounds like you have a deadlock. How many synchronization objects
are you using? If it's a single mutex, you shouldn't deadlock unless
you have some sort of contention over a kernel object that is locked
by an API function.

Post the code that locks the mutex, writes to the file and unlocks the
mutex and perhaps we'll spot the problem. If it's quite long, try to
eliminate irrelevant code first.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top