ThreadPool crashes

With the new tip, i’m getting all types of crashes in different places when the ThreadPool Destructor is called.

I think it may be because you moved to an OwnedArray for jobs and there’s still explicit deletion of a job(search for delete job) in the code.

Does anything jump out for you?

The previous code worked perfectly for me…

EDIT:
Hmmm not an OwnedArray, that’s the threads…odd

I think this might have been my own bad code… looking into it it looks like my pool job can sometimes add another job to the pool. (So removeAllJobs could leave one dangling as the lock gets released and the job added)…

Seems like the old code wasn’t as sensitive as this.

I’m going to try and refactor a little… sorry for the noise

Yea, definitely my problem. Note to anyone who finds this…if you start asserting in killing threads and looking at your other threads and the thread that’s been killed is waiting on a lock, chances are you added a job after remove jobs did its thing(which from what I can tell would only happen if you were stupid enough(talking about myself so I can be harsh) to add jobs from the worker anyway!