I have been thinking about that solution, but what if one of process that acquired acces to resources and created temp file crashed before it can delete this temp file? Other proces will be thinking, that resources are loocked.