| Ticket UUID: | 1080290 | |||
| Title: | Thread-safety for GIF code | |||
| Type: | Patch | Version: | None | |
| Submitter: | dkf | Created on: | 2004-12-06 22:25:59 | |
| Subsystem: | 42. Photo Image|GIF | Assigned To: | dkf | |
| Priority: | 5 Medium | Severity: | ||
| Status: | Closed | Last Modified: | 2005-06-27 04:14:49 | |
| Resolution: | Out of Date | Closed By: | jenglish | |
| Closed on: | 2005-06-26 15:40:52 | |||
| Description: |
The attached patch gives thread-safety for the GIF reading and writing code. The GIF reading code gets thread-safety using thread-local variables, and the GIF writing code has a mutex wrapped about it to protect its extensive static variables. | |||
| User Comments: |
jenglish added on 2005-06-26 22:40:52:
Logged In: YES user_id=68433 Changes made by dkf 2005/06/19 (tkImgGIF.c r1.27 / r1.28) make this patch unnecessary; GIF code is now thread-oblivious. jenglish added on 2004-12-08 00:43:58: File Added - 111598: tk-gif-threadsafety.patch jenglish added on 2004-12-08 00:43:57: Logged In: YES user_id=68433 > Yeah, but that takes a load more effort. :^) Not that much more -- see attached tk-gif-threadsafety.patch. It does add a bit to the stack (about a half K for decoding, ~3/4 K for encoding), though that's easily remedied. Note that the encoder *already* allocates about 20K worth of buffers on the stack, so if stack storage is an issue that should be fixed first. Still to do: get rid of the existing ThreadSpecificData block, and the "HACK ALERT! HACK ALERT!" code that it's protecting. dkf added on 2004-12-07 17:13:52: Logged In: YES user_id=79902 Yeah, but that takes a load more effort. :^) More seriously, we can do better than this, yes, but if we do we need to work out our strategy for doing so. This patch at least makes the code thread-safe (without stuffing masses of buffers on the stack, an approach I'm not 100% happy with as I know it has caused problems in Tcl) and it was cheap to do. jenglish added on 2004-12-07 05:44:06: Logged In: YES user_id=68433 Instead of mechanically wrapping statics and globals into a ThreadSpecificData block, could we do this the right way instead for a change? dkf added on 2004-12-07 05:26:00: File Added - 111497: gif-thread-safe.diff | |||
Attachments:
- tk-gif-threadsafety.patch [download] added by jenglish on 2004-12-08 00:43:58. [details]
- gif-thread-safe.diff [download] added by dkf on 2004-12-07 05:26:00. [details]
