title: zlib: thread safe zalloc and zfree in C?
body: <p>I am using the zlib C library to decompress data received from a network stream, and I have two streams running in two separate NSThreads. As per zlib documentation, decompressing two different zlib streams in two threads requires zalloc and zfree to be thread safe. I am currently passing Z_NULL (my inflateinit code below)</p>
  
  <pre><code>zStream.zalloc = Z_NULL;
  zStream.zfree = Z_NULL;
  zStream.opaque = Z_NULL;
  zStream.avail_in = 0;
  zStream.next_in = Z_NULL;
  int status = inflateInit(&amp;zStream);
  if (status != Z_OK)
      DLog(@"zlib setup error");
  else
      DLog(@"zlib setup ok");
  });
  </code></pre>
  
  <p>Does anyone have experience with using zlib for compressing multiple streams in separate threads? Has anyone seen a thread safe implementation of zalloc and zfree?</p>