What is miner supposed to do when waiting for longpoll
If you run out of work while waiting for longpoll to finish, then what you should do is submit another getwork request.

Note that just because you find a share in a particular piece of work, doesn't mean that you're done with that piece of work. There still might be shares or even a block solution in there somewhere.