On Fri, 21 Mar 2003, Russell Hind wrote:
I had the same problem with C++Builder 6 when first using the filesystem library. The default builds for filesystem are single threaded. If your application is multi-threaded, then you need to re-build the filesystem library with multi-threading (it uses mutexes somewhere (I think from smart_ptr but can't remember)). If you use the single-threaded library, then you don't get the mutex, but the ++operator is inlined and tries to lock it. This causes a hang as the win32 light-weight mutex is stored as just an integer (long maybe), so the program just hangs waiting for it to be cleared.
I have built four versions of the library
libboost_filesystem.lib - release, single-threaded libboost_filesystemd.lib - debug, single-threaded libboost_filesystemmt.lib - release, multi-threaded libboost_filesystemmtd.lib - debug, multi-threaded
I use a #pragma int the code to link the appropriate lib depending on Borland's __MT__ define (and also if I want debugging or not)
HTH
Russell
That makes sense, thanks. It would be good if all four versions were built by bjam, or if this was mentioned somewhere in the docs. I wonder why it was decided to have locking on directory iterators at all, seems a bit low level? Thanks for your help Russ