Is it possible to start execution of a queue in the middle of another execution?

Is it possible to start execution of a queue in the middle of another execution?

Hello everyone,

This is my second forum post (previous one: problem when creating simple counter in jQuery) and i would like to ask you question on queue execution before another execution ends. This is what i want to do

  1. <html>
  2. <head>
  3. <script type="text/javascript" charset="utf-8" src="http://code.jquery.com/jquery-1.8.2.min.js"></script>
  4. <script type="text/javascript">
  5. $(document).ready(function()
  6. {
  7. var status = "run";
  8. var temp = 1;
  9. while(status == "run")
  10. {
  11. (function(temp, status)
  12. {
  13. $("body").queue("exprQueue", function(next)
  14. {
  15. temp++;
  16. if(temp == 1000)
  17. {
  18. status = "stop";
  19. $('div').html(temp);
  20. }
  21. next();
  22. });
  23. })(temp, status);
  24. $("body").dequeue( "exprQueue" );
  25. }
  26. });
  27. </script>
  28. </head>
  29. <body>
  30. <div></div>
  31. </body>
  32. </html>
when the document is ready, a while loop will be executed every time checking the status variable. Inside this loop, a queue method is scheduled which will change the status variable. When i run this piece of code, the browser freezes and i guess the queue method is not executed before completion of while loop.

Could anyone help me solve this problem?

Thank you in advance