On Tuesday 10 February 2015 22:26:50 Thiago Macieira wrote:
> It's not insurmountable. I can think of two solutions:
>  1) pre-allocate enough space for the UTF-16 data (strlen(utf8) * 2), so
> that  the const functions can implicitly write to the UTF-16 block when
> needed. Since the original UTF-8 data is constant and if there are no
> out-of-thin-air values, multiple threads could do this operation
> simultaneously safely.

No, they can't. The writes conflict and neither happens-before the other -> 
data race -> UB.

Your #2 is sound, of course, as long as readers loadAcquire the utf16 data 
pointer.

-- 
Marc Mutz <marc.m...@kdab.com> | Senior Software Engineer
KDAB (Deutschland) GmbH & Co.KG, a KDAB Group Company
www.kdab.com || Germany +49-30-521325470 || Sweden (HQ) +46-563-540090
KDAB - Qt Experts - Platform-Independent Software Solutions
_______________________________________________
Development mailing list
Development@qt-project.org
http://lists.qt-project.org/mailman/listinfo/development

Reply via email to