Re: [AD] tls.c

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


Actually there's a memory leak! Patch against current svn below
Index: src/tls.c
===================================================================
--- src/tls.c   (revision 9797)
+++ src/tls.c   (working copy)
@@ -142,9 +142,13 @@

 static pthread_key_t tls_key = 0;

+static void osx_thread_destroy(void* ptr)
+{
+   _AL_FREE(ptr);
+}
 void osx_threads_init(void)
 {
-   pthread_key_create(&tls_key, NULL);
+   pthread_key_create(&tls_key, osx_thread_destroy);
 }

 static thread_local_state _tls;


On Jan 6, 2008 2:04 AM, Trent Gamblin <trent@xxxxxxxxxx> wrote:
> On Sat, January 5, 2008 7:12 am, Peter Hull said:
> > Please find below a patch to add thread-local storage support for
> > OSX.
> > Someone might be able to rearrange things to make it a bit neater
> > overall.
> >
> > Peter
>
> Thanks, applied.
>
> Trent
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2005.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> --
> https://lists.sourceforge.net/lists/listinfo/alleg-developers
>




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/