usage of resmgr_attach()

i want have a programme that call resmgr_attach()( path of args is /dev/sample ), if i run the programme two (first didn’t stop). i want to let second exit because /dev/sample have been created. what should i do?