Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

creating a deadlock.

 
mitti sharma
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have to create a dead lock in the following code that has two worker threads that carry out the addition.
my assignment says it can be done by adding one line of code.
i was able to do it by changing the order of arguments(In w2 i changed it from s,a to a,s)

Worker w1 = new Worker (s,a);
Worker w2 = new Worker (a,s);

but as i said i have to add code line not alter the orignal one,so
can someone suggest me if there are other ways to put this in deadlock?

-----------------------------------------------------
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic