The code for apple and linux cases is identical (except one case). Consider
#if defined(__APPLE__) || defined(__linux__) #define POSIX #endifand consolidate the identical blocks under
#ifdef POSIX. Or consistently do#ifdef __WIN32__ .... #else .... #endifas you did near the end of
forp.Determining a number of processors by parsing an output of an external command doesn't look right. See this answer for details.
All functions except
forpshall be static. Especiallyconcurrent_queue_t_enqueue, which is surely not designed for a public access.I don't see why
concurrent_queue_tis implemented as a linked list. An array oftask_descwith a mutex-protected cursor seems enough. It is much easier on memory.It is advisable (though not mandatory) to avoid
_ttype names. See B.2.12 Data TypesB.2.12 Data Types section of the Posix standard (1003.1, Rationale (Informative)).