diff options
author | jb <jb@FreeBSD.org> | 1998-04-29 09:08:43 +0000 |
---|---|---|
committer | jb <jb@FreeBSD.org> | 1998-04-29 09:08:43 +0000 |
commit | 0d8f4028aff079cdb11c4fe2e8c7352a67d39dd2 (patch) | |
tree | e6d0d99c5226be85527dea5fe16c34c07533aa8b | |
parent | 44b61e0100175e879d2c682de277d85fcb200583 (diff) | |
download | FreeBSD-src-0d8f4028aff079cdb11c4fe2e8c7352a67d39dd2.zip FreeBSD-src-0d8f4028aff079cdb11c4fe2e8c7352a67d39dd2.tar.gz |
Reference an external variable in threaded programs so that the
autoinitialiser gets linked in and therefore called before main().
-rw-r--r-- | lib/libc/stdlib/exit.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/libc/stdlib/exit.c b/lib/libc/stdlib/exit.c index 5df19dc..b0f6d3a 100644 --- a/lib/libc/stdlib/exit.c +++ b/lib/libc/stdlib/exit.c @@ -60,6 +60,12 @@ exit(status) register struct atexit *p; register int n; +#ifdef _THREAD_SAFE + extern int _thread_autoinit_dummy_decl; + /* Ensure that the auto-initialization routine is linked in: */ + _thread_autoinit_dummy_decl = 1; +#endif + for (p = __atexit; p; p = p->next) for (n = p->ind; --n >= 0;) (*p->fns[n])(); |