 <p>Perhaps the problem is already at the point where you <code>malloc</code> your <code>data</code>. It gets past around wrong (<code>0x4</code> isn't plausible) so probably you already have had problems there. A common error is to forget to include the header file and have <code>malloc</code> interpreted as returning <code>int</code> per default rules.</p> <p>Casting almost always hides a programming or, worse, design error:</p> <ul> <li>don't cast the return value of <code>malloc</code>. <code>malloc</code> returns <code>void*</code> this is compatible with any other data type pointer</li> <li>don't cast pointers to <code>void*</code> as you do when calling <code>pthread_create</code>. All data type pointers are converted to <code>void*</code> without problems</li> </ul>