title: Deadlocking thread tcp server
body: <p>I am using c++ with boost threads, locks mutexs and all that good stuff.</p>
  
  <p>Two threads A and B. A is a networking thread where there is information coming back and forth from the client. B is a worker with variables which needs to be thread safe.</p>
  
  <p>There are multiple threads from the class A and B is just a single thread. Instances of A will be added to B’s list of jobs and A will lock until B has completed the task. (The thread safe list of jobs works fine)</p>
  
  <p>A adds the job to B and then locks, however in most cases before A has locked. B will have processed the job and have (tried to) release the lock before A has applied it. Resulting in As dead lock.   </p>
  
  <p>I am not sure what I should be doing here. I could post code but I would imagine is easier to discuss conceptually.  </p>