Commit graph

98 commits

Author SHA1 Message Date
David Chisnall
6893ce1a95 Lazily initialize POSIX threads, matching OS X behaviour and stopping us from crashing when calling autorelease from a thread that was not previously registered explicitly (yuck!)
Also do some quite hacky (and not totally correct) things to try to make sure that we aren't confused into thinking that the first NSThread is the main thread, if it's created on a separate thread.  Currently only supported on FreeBSD and OpenBSD.



git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@33521 72102866-910b-0410-8b05-ffd578937521
2011-07-11 14:31:36 +00:00
Richard Frith-MacDonald
a69b7c2466 always create autorelease pools for mixed GC mode support
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@33212 72102866-910b-0410-8b05-ffd578937521
2011-05-31 07:55:06 +00:00
David Chisnall
4db587f9d6 First pass at hybrid GC mode. This will try use retain-release mode if the collector is not running. Code will run in retain/release mode unless something compiled with -fobjc-gc-only is loaded.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@33174 72102866-910b-0410-8b05-ffd578937521
2011-05-28 14:51:40 +00:00
David Chisnall
68f1581eb9 This one isn't really important, since this code path is only ever used in non-GC mode, but it keeps the static analyser happy.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@33145 72102866-910b-0410-8b05-ffd578937521
2011-05-27 12:00:57 +00:00
David Chisnall
7764740bdc Make -drain and -release in NSAutoreleasePool do the same thing (rather than one calling the other) in non-GC mode.
Replace all -release messages sent to autorelease pools with -drain.  In non-GC mode, these are equivalent.  In GC mode, these trigger a collection.



git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@33143 72102866-910b-0410-8b05-ffd578937521
2011-05-27 11:48:44 +00:00
David Chisnall
6068e9484c Initial pass at implementing fully Apple-compatible GC. This requires the code to be built with -fobjc-gc or -fobjc-gc-only, and requires a runtime that implements all of the support functions (GNUstep runtime trunk or 1.5 when it's release).
Currently, there are a few places where we should be calling NSAllocateCollectable() without NSScannedOption, but are actually calling NSZoneMalloc() unless we're in GC mode.  We should not need separate code paths for this anywhere outside NSZone, since NSAllocateCollectable() will work in non-GC mode as well.

A few of the changes should be tweaked slightly so that they do run-time tests.  For example, when compiling with -fobjc-gc, we may be linked against non-GC code, which will use -retain and -release but won't use the memory barriers.  Supporting this nicely is a lot of effort, and I'm not fully convinced it's a good idea.



git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@33104 72102866-910b-0410-8b05-ffd578937521
2011-05-24 14:43:27 +00:00
Richard Frith-MacDonald
e32626abe7 try to cope better with apps which leak autorelease pools.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@33099 72102866-910b-0410-8b05-ffd578937521
2011-05-24 10:52:25 +00:00
Richard Frith-MacDonald
683386b6c6 add comments for clarification
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@32697 72102866-910b-0410-8b05-ffd578937521
2011-03-24 06:24:05 +00:00
Richard Frith-MacDonald
74eac99280 add last night's changes based on static analyser results.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@32507 72102866-910b-0410-8b05-ffd578937521
2011-03-09 10:24:18 +00:00
Richard Frith-MacDonald
b80266e49b simple implementation for gc
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@32419 72102866-910b-0410-8b05-ffd578937521
2011-02-28 21:59:42 +00:00
Richard Frith-MacDonald
0cb48d516b Update for new runtime api
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@32241 72102866-910b-0410-8b05-ffd578937521
2011-02-20 08:32:54 +00:00
Richard Frith-MacDonald
6f4f708a6f Reduce internal class interdependency for improved maintainability.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@32083 72102866-910b-0410-8b05-ffd578937521
2011-02-11 16:04:05 +00:00
Richard Frith-MacDonald
14b91c9052 fixups for libobjc2
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@29753 72102866-910b-0410-8b05-ffd578937521
2010-02-25 18:49:31 +00:00
Richard Frith-MacDonald
c07dc48eb3 more header reorganisation
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@29731 72102866-910b-0410-8b05-ffd578937521
2010-02-25 08:36:34 +00:00
Richard Frith-MacDonald
8769dd8b6f deprecates some gnustep runtime wrappers
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@29697 72102866-910b-0410-8b05-ffd578937521
2010-02-22 10:13:20 +00:00
Richard Frith-MacDonald
7cc69dfaae Simplify header inclusion
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@29669 72102866-910b-0410-8b05-ffd578937521
2010-02-19 08:12:46 +00:00
Richard Frith-MacDonald
c8a6832349 cosmetic tweaks
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@29657 72102866-910b-0410-8b05-ffd578937521
2010-02-17 11:47:06 +00:00
Richard Frith-MacDonald
21d597e740 merge back reorganisation branch
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@29615 72102866-910b-0410-8b05-ffd578937521
2010-02-14 10:48:10 +00:00
Richard Frith-MacDonald
b8ccc9459d thread termination fixups
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@29461 72102866-910b-0410-8b05-ffd578937521
2010-02-01 21:08:45 +00:00
Richard Frith-MacDonald
02a93a74af Have -drain call -release
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@28950 72102866-910b-0410-8b05-ffd578937521
2009-11-04 05:51:34 +00:00
Richard Frith-MacDonald
94296c4747 implement -drain
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@27654 72102866-910b-0410-8b05-ffd578937521
2009-01-22 15:59:06 +00:00
Fred Kiefer
bff3fe7ca0 When a thread ends clear the autorelease pool cache of that thread and
not of the current one.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@26819 72102866-910b-0410-8b05-ffd578937521
2008-08-25 15:39:02 +00:00
Richard Frith-MacDonald
b2b14398d2 allow developers more time to adapt to LGPLv3
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@26606 72102866-910b-0410-8b05-ffd578937521
2008-06-08 10:38:33 +00:00
Richard Frith-MacDonald
ec0b3ab41a MacOS-X compatibility updates.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@26598 72102866-910b-0410-8b05-ffd578937521
2008-06-06 13:57:06 +00:00
Richard Frith-MacDonald
4fb2f3c708 Use get_imp() to get method implementation
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@26359 72102866-910b-0410-8b05-ffd578937521
2008-03-19 08:57:14 +00:00
Richard Frith-MacDonald
50a244c4c2 MacOS-X compatibility tweaks
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@26345 72102866-910b-0410-8b05-ffd578937521
2008-03-18 13:55:46 +00:00
Richard Frith-MacDonald
ef453e89d7 Use +instanceMethodForSelector: to cache method for class.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@26298 72102866-910b-0410-8b05-ffd578937521
2008-03-13 17:34:44 +00:00
Richard Frith-MacDonald
368a16a5c8 Minor tweak to cope with EOFault
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@26258 72102866-910b-0410-8b05-ffd578937521
2008-03-10 11:09:40 +00:00
Richard Frith-MacDonald
566d6ed569 Add some diagnostics for memory management errors (deallocating a deallocated
object).


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@26085 72102866-910b-0410-8b05-ffd578937521
2008-02-18 09:59:16 +00:00
Richard Frith-MacDonald
635c255ed2 NSThread updates and cleanup
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@25608 72102866-910b-0410-8b05-ffd578937521
2007-11-25 14:49:05 +00:00
Richard Frith-MacDonald
62559023b9 Update to GPL3 and LGPL3
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@25482 72102866-910b-0410-8b05-ffd578937521
2007-09-14 11:36:11 +00:00
Richard Frith-MacDonald
bd0963b109 Fix bug returning autorelease count.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@24434 72102866-910b-0410-8b05-ffd578937521
2007-01-30 18:05:34 +00:00
Richard Frith-MacDonald
0d0ae9d9a8 More tidyups
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@23914 72102866-910b-0410-8b05-ffd578937521
2006-10-19 13:51:19 +00:00
Richard Frith-MacDonald
db7cf4a3fc Help avoid programs getting huge memory footprints when they don't need to.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@23077 72102866-910b-0410-8b05-ffd578937521
2006-06-17 17:20:22 +00:00
Richard Frith-MacDonald
087e9db5e6 avoid spurious compiler warnings
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@23027 72102866-910b-0410-8b05-ffd578937521
2006-06-04 06:42:10 +00:00
Richard Frith-Macdonald
7ee4008457 Fix unnecessary extra pool creation.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@22339 72102866-910b-0410-8b05-ffd578937521
2006-01-20 17:12:33 +00:00
Richard Frith-Macdonald
178aecf1db Catch autoreleased objects during thread exit.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@22333 72102866-910b-0410-8b05-ffd578937521
2006-01-19 06:15:27 +00:00
Richard Frith-Macdonald
06981169ed Fixes for 64bit systems .. mostly cosmetic avoidance of compiler warnings.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@22282 72102866-910b-0410-8b05-ffd578937521
2006-01-10 10:29:11 +00:00
Adam Fedor
fcc13ccd0f * Update FSF Address.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@21245 72102866-910b-0410-8b05-ffd578937521
2005-05-22 03:32:16 +00:00
Richard Frith-Macdonald
7bd5f9b5b0 Try to handle destruction of an autorelease pool more robustly.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@20860 72102866-910b-0410-8b05-ffd578937521
2005-03-06 15:08:12 +00:00
Richard Frith-Macdonald
d9eff62ccf Fix fosdem changes and a few bugs exposed by them.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@20811 72102866-910b-0410-8b05-ffd578937521
2005-02-28 17:18:54 +00:00
Richard Frith-Macdonald
8c80371455 Fosdem updates.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@20805 72102866-910b-0410-8b05-ffd578937521
2005-02-27 10:46:19 +00:00
Richard Frith-Macdonald
db7b22a4fb Tidy up use of white space so we have it after if/for/while and not after (
or before ) or padding at end of line.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@20773 72102866-910b-0410-8b05-ffd578937521
2005-02-22 11:22:44 +00:00
Richard Frith-Macdonald
a2a82f6a37 Revert an nsthread change and try to avoid memory leaks when autorelease
pools are created during the thread exit process.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@20287 72102866-910b-0410-8b05-ffd578937521
2004-11-03 13:20:39 +00:00
Richard Frith-Macdonald
c5849bb8dd Fix for inefficiency/leak in emptyPool
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@19789 72102866-910b-0410-8b05-ffd578937521
2004-07-29 10:54:55 +00:00
Richard Frith-Macdonald
d0a274bd0d Documentation improvements.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@19326 72102866-910b-0410-8b05-ffd578937521
2004-05-14 16:22:49 +00:00
David Ayers
ac30183cd6 Header reorganizsateion - Please refer to ChangeLog
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@17407 72102866-910b-0410-8b05-ffd578937521
2003-07-31 23:49:32 +00:00
Richard Frith-Macdonald
6341c223a6 Tidied
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@16923 72102866-910b-0410-8b05-ffd578937521
2003-06-15 05:24:07 +00:00
Richard Frith-Macdonald
8e8a68a78f Documentation improvements.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@16922 72102866-910b-0410-8b05-ffd578937521
2003-06-15 05:18:27 +00:00
Adam Fedor
d228cba99b Change syntax of includes
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@16874 72102866-910b-0410-8b05-ffd578937521
2003-06-07 01:24:41 +00:00