title: multi thread Issue in phonegap ios and android
body: <p>I had created this code to handle threads in PhoneGap, but if I run this code I am getting the following error. </p>
  
  <pre><code>Thread 14 WebCore: Database: EXC_BAD_ACCESS (code = 1, address = Oxbbadbeef)
  </code></pre>
  
  <p>I am also using another thread which looks like the one which I had pasted above,  suddenly my application crashes and getting the same error message, and I would also like to use the same multi thread code for both android and Ios could someone suggest me a better way to reuse the same code for both android and Ios ? </p>
  
  <p>So what am I missing in this, and How can i fix this ?</p>
  
  <p>Here is my code :</p>
  
  <pre><code>function itmerStart()
  {
      if (timerId) return
  
          timerId = setInterval(loadMessageListCron, 20000);
  
      function loadMessageListCron()
      {
          var userid = window.localStorage.getItem("userId");
          if(userid != undefined)
          {
              alert("thread calling..");
              $.ajax("//abc.com/Rest/get_all_messages?UserId="+ userid).done(function(data)
             {
                var i, response;
                $.each(data.messages, function (i, response)
                {
  inboxMessageItmerStop();                                                                                         insertMessages(response, i);
  inboxMessageItmerStart();
           });
          });
          }
      }
  }
  </code></pre>