# Re: \[RFC\]\[PATCH RT 0/3\] RT: Fix trylock deadlock without msleep() hack

- From: Steven Rostedt \<rostedt@goodmis.org\>
- Date: 2015-09-05 12:26:39 
- List: linux-rt-users
- Page: https://ratatoskr.run/linux-rt-users/2015/09/4570255
- Thread: https://ratatoskr.run/linux-rt-users/2015/09/4569401/t.md

```text
On Sat, 5 Sep 2015 14:04:57 +0200
Ingo Molnar [ref] wrote:

 
> So why not do:
> 
> 	lock(B);
> 	if (!trylock(A)) {
> 		unlock(B);
> 		lock(A);
> 		lock(B);
> 	}
> 
> ?
> 
> Or, if this can be done, why didn't we do:
> 
> 	lock(A);
> 	lock(B);
> 
> to begin with?
> 
> i.e. I'm not sure the problem is properly specified.

Yeah, this is actually the solution I came up with before. I misread
what Thomas wrote. His is slightly different.

-- Steve
```
