Implemented basic locale support. Added some missing interlocked functions. svn path=/trunk/; revision=2056