Overview
| Artifact ID: | c45e20bfb763f59714f1d0540754ba81cffce0e3 |
|---|---|
| Ticket: | 3567063fffffffffffffffffffffffffffffffff
portable Tcl_CreateThread inherit of fp settings |
| User & Date: | dgp on 2012-09-12 15:42:42 |
Changes
- assignee changed to: "mistachkin"
- cmimetype changed to: "text/plain"
- comment changed to:
The unix implementation of Tcl threading support is built on the pthread library, and the routine pthread_create() is at the core of all Tcl thread creation on unix. pthread_create() documents how it manages the initialization of the floating point environment in the created thread: "The floating-point environment shall be inherited from the creating thread." This is a very useful default behavior for programs performing multi-threaded calculations, keeping all threads computing in a consistent way. Empirically, we do not see this desirable behavior from Tcl_CreateThread() on Windows. In particular, when the master thread is computing using 80-bit extended precision computations, all threads created by T_CT() do their computations using only the default 64-bit precision operations. Even code explicitly written using C "long double" variables gets only 64-bit precision function when run in a Tcl non-master thread. The consequence is that computed results are not portable. Tcl_CreateThread() takes an argument for a thread initialization procedure, so those programs that care about this detail have the ability to use that routine to workaround this problem. The disadvantage is that the code to query and set the floating point environment is a nonportable mess, depending on hardware and OS and compiler and other details. Coding a portable solution to forcing fp environment inheritence is a big, thorny problem. It's exactly the kind of portability chore that programs rely on the Tcl library to solve in other scenarios. It's a tall order, but I'd like it if Tcl_CreateThread() aimed at making the fp environment inheritance of pthread_create() a cross-platform feature as much as possible. - foundin changed to: "None"
- is_private changed to: "0"
- priority changed to: "5 Medium"
- resolution changed to: "None"
- status changed to: "Open"
- submitter changed to: "dgp"
- subsystem changed to: "49. Threading"
- title changed to: "portable Tcl_CreateThread inherit of fp settings"
- type changed to: "RFE"