title: C# Event not raised and Threads
body: <p>I'm having some trouble with an event. The problem is that sometimes the event just isn't raised.</p>
  
  <p>We've got a camera from an company which we've implemented in our software. In the software we register an event which is triggered every time an image is taken on the camera.</p>
  
  <p>I've noticed that with an increase of need in processing power (e.g. calculating average mean on images and working with bigger images) will sometimes result in the event not being raised. Furthermore I can make this happen even more often by increasing the frame-rate of the camera. I know a frame is missing because they are marked with ID's.</p>
  
  <p>In their own demo software I'm able to run at the same speed with no problems. Their software doesn't perform any calculations or anything, it just receives and displays the image.</p>
  
  <p>I'm baffled because this is the closest connection to the camera I have; all I can do is wait for the event to rise. I'd like to ask you if you know of any situation where an event would be ignored.</p>
  
  <p>To me it looks like the camera is firing an image but for some reason the even't isn't picking up (overload?).</p>
  
  <p>Here is some of the related code:</p>
  
  <pre><code>private void Camera_OnFrameReceived(AVT.VmbAPINET.Frame frame)
  {
      if (frame.ReceiveStatus == VmbFrameStatusType.VmbFrameStatusComplete)
      {
          if (lastID != 0 &amp;&amp; lastID != 1)
          {
              if(frame.FrameID - lastID &gt; 1)
                  Debug.WriteLine("HEEEEYYY SKIPPED A FRAME, ID: " + frame.FrameID.ToString() + " TOTAL LOST: " + (frame.FrameID - lastID - 1).ToString());
          }
          lastID = frame.FrameID;
          //Debug.WriteLine("Frame received from camera");
  
          //if the camera is in single mode, dont raise the event (frame already taken)
          if (Mode == CaptureMode.Single)
              return;
  
          //set the last frame
          _frameQueue.Enqueue(frame);
  
          if (FilmFrameReady != null)
          {
              DateTime dateTime = Accurate.DtNow;
              frameTaken = false;
              FilmFrameReady(this, new FilmFrameReadyArgs(this, dateTime));
          }
      }
  }
  </code></pre>
  
  <p>As you can see I take the frame, add it to a queue, and then tell my outside classes that there's something for them to fetch. I'm releasing the event thread as quickly as possible.</p>
  
  <p><strong>Summary:</strong></p>
  
  <p>My event is sometimes not raised. I think it's because the main thread is working too hard.</p>
  
  <p>Do you have any experience with events sometimes not being raised?</p>