Re: [AD] Working on ex_threads, d3d_display_format.cpp, tls.c

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


The thing is this state isn’t public, it’s only used in the D3D driver internally.

 

 

 

From: Elias Pschernig
Sent: August 21, 2016 7:13 PM
To: Edgar Reynaldo
Cc: Allegro Developers
Subject: Re: [AD] Working on ex_threads, d3d_display_format.cpp, tls.c

 

On Sun, Aug 21, 2016 at 6:06 PM, Edgar Reynaldo <edgarreynaldo@xxxxxxxxxx> wrote:

I have a few questions though.

1. What is the proper way to access the tls_get function and the thread_local_state? There is no public api available to access tls_get, nor is there a private one. In tls.c, getter and setter functions are used to interact with the thread_local_state. Is this the preferred way to do this? Alternatively, there is the tls_get function, which seems the most appropriate to use in this case (for d3d_display_formats.cpp). It is accessible through one of three different headers, (tls_dll.inc , tls_pthread.inc , or tls_native.inc).

 

There are many public functions in https://github.com/liballeg/allegro5/blob/master/src/tls.c - like al_get_new_window_title. I would just put another getter/setter pair there for your new addition. That way *all* access to TLS is contained to this one file.

 


2. Should there be a public (at least public to the library) header available for the tls_get function? I propose moving the includes for tls_dll.inc, tls_pthread.inc, and tls_native.inc into their own tls header. Perhaps into tls.h, or into aintern_tls.h?

 

I would say no - unless a getter/setter does not work for some reason.

 

I have made a preliminary patch for this, available as an attachment. It's not complete though. There are some specific things that need to be completed first, such as solving #1 (how to import the tls_get function into d3d_display_formats.cpp), and what to do when tls_get returns NULL.

This was first discussed on the a.cc forum, but I haven't had time to do much until recently. See the associated thread here :
https://www.allegro.cc/forums/thread/616214/1021962#target

Let me know what you want me to do.

Thanks,
Edgar


_______________________________________________
Allegro-developers mailing list
Allegro-developers@xxxxxxxxxx
https://mail.gna.org/listinfo/allegro-developers

 

 



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