double free or corruption error when using parallel foreach

FG home at fgda.pl
Fri Dec 28 02:17:15 PST 2012


On 2012-12-28 01:08, Minas Mina wrote:
> Note that there is more code after bool hit = ...
> but I didn't include it because the problem is in the trace
> function (I commented it out and everything else worked -- apart
> from the things are dependent on it of course)

Why don't you show the trace function then? Where's the rest of the code?

> [xcb] Unknown request in queue while dequeuing
> [xcb] Most likely this is a multi-threaded client and
> XInitThreads has not been called
> [xcb] Aborting, sorry about that.
> raytracing: ../../src/xcb_io.c:178: dequeue_pending_request:
> Assertion `!xcb_xlib_unknown_req_in_deq' failed.
> bash: line 1: 18982 Aborted                 (core dumped)
> /home/minas/Projects/D/raytracing/raytracing/bin/Release/raytracing

This sheds some light on the problem.
Probably it would go away if only a single thread was made responsible for calls 
into libxcb. That's a preferable, safer approach than initializing for 
multi-threading (but have you done the initializing?).

> double free or corruption

IMO that's just a consequence of several threads manipulating same data without 
any locks or synchronization in place.



More information about the Digitalmars-d-learn mailing list