This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [basic-improvements] Remove __gthread_key_dtor


On Mon, Nov 04, 2002 at 12:41:08PM -0800, Eric Christopher wrote:
> > 
> > There needs to be just one version of these variables, but gthr.h is
> > included all over the place - this needs to go out-of-line, into a
> > libgcc.a extra part, probably along with the code that uses it.
> 
> Hrm. I was noticing that other ports use this method and that's why I
> did - I also didn't see a way for it to work otherwise since there's no
> general .c mechanism for it.

You create a .c file in config/ARCH, and mention it in the LIB2ADD
variable in your t-TARGET file.

> > I take it there can be only 256 threads?
> 
> Heh. Threads? No. I've got semaphores and only semaphores.

Er, what's this GetThreadId() then?

> > There is no requirement that dtor be nonzero, and you threw away its
> > value; this will cause memory leaks.  You're going to need to find
> > some way to get a callback run at thread exit time.  And that callback
> > can do the clear-out-the-value thing.
> 
> hrm. If I could do that I could also free semaphores which would help me
> avoid the 253 limit that I currently have. I was under the impression
> that this was not possible though - at least not without rewriting the
> machinery. 

If the underlying API doesn't support this, you're out of luck.  But
if there _is_ a way to get a callback run at thread exit time, you can
just set one up in your init-once routine.

Take a look at gthr-vxworks.h, config/vxlib.c, and config/t-vxworks on
the gcc-3_4-basic-improvements-branch (after I commit them, which will
happen in the next twenty minutes or so) -- they should give you some
ideas.

zw


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]