[Threads] error notification (joining an already exited thread in Windows debug builds)

Hi, using a thread_group, I have an application that runs something like this: thread_group myThreads; for each thread we need myThreads.create_thread(reference to thread function) for each work item { add work item to queue // threads just created start doing the work... } add 'finish' task to queue myThreads.join_all() delete threads... etc etc When running under windows debug build I noticed that the join on the individual threads in the group can fail the assertion: assert(res == WAIT_OBJECT_0); But rather unhelpfully it doesn't include the error code returned by the call or GetLastError() as to why ! In my case I belive this is because the thread has already exited before joining or something similar. now the question would be of course what to do if an error occurs during a non-debug build as the assert will not be there most likely and I'd never notice any problems as the reult is discarded. Thread join could return something rather then being void, that the thread group could then pass back, but then what if the failure occurs half way through the thread group? Should it return a list of error indicators? e.g. thread is not joinable, thread id is invalid, deadlock detected (POSIX optional), or should this be a 'checked_join_all()' (join_all_checked() ?) Is there any work going on that might addrss these concerns? (I checked the CVS branches but didn't find anything obvious) Thanks Kevin -- | Kevin Wheatley, Cinesite (Europe) Ltd | Nobody thinks this | | Senior Technology | My employer for certain | | And Network Systems Architect | Not even myself |
participants (1)
-
Kevin Wheatley