Commit graph

93 commits

Author SHA1 Message Date
Hugo Melder
6681a3da47
Initial port of WinObjC's KVO implementation to GNUstep (#420)
* GSAtomic: Add prefix to macro definitions

* NSKVOSupport: Import

* NSKVOSupport: Add test cases

* NSKVOSwizzling: Ugly C Rewrite

* NSKeyValueObserving: Use old implementation as fallback

* NSKeyValueObserving: Rename TypeEncodingCases header

* NSKVOSupport: Fix new objects not being added to NSKeyValueChangeNew set on set mutation

* NSKeyValueMutableSet: Fix will and didChange notifications for set operations

* NSKeyValueMutableSet: Document Accessor Search Patterns

* NSKVOSupport: Add toMany test

* NSKeyValueCoding: Change notifications when changing value via setValue:forKey:

* NSKVOSupport: Add more tests

* NSKVOSupport: Do not wrap block in try/finally to avoid crash in windows

* NSKVOSwizzling: use _alloca on Windows

* NSKVOSupport: Do not autorelease newWithObservee:

* NSKVOSupport: Do not leak Observee and TestFacade objects

* Improve runtime detection in makefile

* Add file extension of source file in GNUMakefile

* NSKVOSupport: Remove @status comments

* NSKVOSupport: Implement private notify method

* NSUserDefaults: KVO Support and fix macOS incompatibilities

* NSKeyValueObserving: Set old to null if nil

* NSKeyValueObserving: Remove cached new value

* NSMethodSignature: Add signature cache

* NSKVOSupport: Remove ObjC2 features and mark tests failing on GCC as hopeful

* Call class method instead of private _keyPathsForValuesAffectingValueForKey

* Move _keyPathsForValuesAffectingValueForKey body into class method and statically construct empty NSSet

* NSUserDefaults: Change notification should contain old value from other domains aswell

* NSUserDefaults: Fetch new value from all domains

* NSKVOInternal: Fixup filename in header

* NSUserDefaults: Go through search list instead of only one domain in KVO change

* Making indentation a bit less worse

* Add NSUserDefaults KVO tests

* NSKVOSupport: NSUserDefaults test small fixes

* Add autoreleasepool

* NSUserDefaults: Only emit change notifications if value changed

* Avoid compiler warnings and tidy some of the whitespace/formatting

---------

Co-authored-by: Frederik Seiffert <frederik@algoriddim.com>
Co-authored-by: rfm <richardfrithmacdonald@gmail.com>
Co-authored-by: rfm <rfm@gnu.org>
2024-11-10 17:05:23 +01:00
rfm
6667842dd5 Update FSF address as requested by Gregory 2024-11-07 13:37:59 +00:00
rfm
a5beb6ab31 Fix for bug #399 2024-04-29 13:11:35 +01:00
rfm
6ad8953196 fix minor documentation generation warning 2023-12-21 20:20:52 +00:00
rfm
286a127501 Warn about unmatched <ignore> tags 2023-12-12 20:45:06 +00:00
Richard Frith-Macdonald
65163ebf48 Add testcases and corrected code to check for GSMacOSXCompatibility mode
when unlocking fails.  Also put more detail in the warning message
2023-09-17 23:35:03 -04:00
Gregory John Casamento
05dd8a4c2a Add code using getenv to show #rfm the current failure 2023-09-11 11:02:14 -04:00
Gregory John Casamento
881a77bd3d Add GSMacOSXCompatible check, do it just to unlock since that is the immediate issue 2023-09-09 12:54:14 -04:00
Gregory Casamento
ba3b31ced2 Issue a warning instead of throwing an exception 2023-09-09 12:54:14 -04:00
Frederik Seiffert
abfe4e2a04 Use native threading and locking APIs on Windows
Removes dependency on pthread library and uses fast Slim Reader/Writer (SRW) locks for NSLock/NSRecursiveLock/NSCondition/NSConditionLock as well as all internal locks. Adds GS_MUTEX_*() macros in GSPThread.h, that are being used for all internal locking instead of pthread APIs.

Also adds support for thread priorities on Windows, fixes method signature of +[NSThread setThreadPriority:] to match Apple platforms, and adds error handling in same method.
2021-07-29 14:22:27 +02:00
Gregory John Casamento
753c907938 Fix address for FSF and License name in all headers in base 2019-12-09 18:36:00 -05:00
Richard Frith-Macdonald
c2fb3a0954 avoid compiler warning by declaring variable at start of block 2018-04-13 10:55:12 +01:00
Richard Frith-Macdonald
0043a7be8d Improve workaround; use NSAllocateObject() 2018-04-12 21:41:15 +01:00
Richard Frith-Macdonald
57f78a6a7a temporary workaround for crash 2018-04-12 21:35:48 +01:00
Richard Frith-Macdonald
cc7a146796 More changes to make lock tracking more robust 2018-04-04 14:42:20 +01:00
Richard Frith-Macdonald
603c3b1103 indicate trace by use of subclass rather than flag 2018-04-04 12:58:06 +01:00
Richard Frith-Macdonald
05439fe15d Experimental deadlock detection code 2018-03-26 15:20:48 +01:00
Richard Frith-Macdonald
81102fae85 improve logging of http comms and of deadlocks 2018-03-16 15:11:02 +00:00
Richard Frith-MacDonald
78c05bfc01 Avoid compiler warnrings
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@38888 72102866-910b-0410-8b05-ffd578937521
2015-08-16 10:42:48 +00:00
Richard Frith-MacDonald
999fda788a Thread diagnositc changes
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@38768 72102866-910b-0410-8b05-ffd578937521
2015-07-08 12:54:15 +00:00
Richard Frith-MacDonald
8d25078d34 Improve lock description
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@38723 72102866-910b-0410-8b05-ffd578937521
2015-06-30 10:49:19 +00:00
Richard Frith-MacDonald
ec04844484 Diagnostic for deadlocked threads
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@38722 72102866-910b-0410-8b05-ffd578937521
2015-06-30 08:43:28 +00:00
Richard Frith-MacDonald
ed09c55959 leak detection improvements
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@37003 72102866-910b-0410-8b05-ffd578937521
2013-08-22 15:44:54 +00:00
Richard Frith-MacDonald
3329cac81c fix for bug #39126
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@36686 72102866-910b-0410-8b05-ffd578937521
2013-05-31 09:28:14 +00:00
Richard Frith-MacDonald
fbdcab1d55 solaris thread-saff errrno fix
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@33983 72102866-910b-0410-8b05-ffd578937521
2011-10-14 11:40:34 +00:00
Richard Frith-MacDonald
fcf071b0b7 fix bug #34154
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@33792 72102866-910b-0410-8b05-ffd578937521
2011-08-27 16:46:26 +00:00
Richard Frith-MacDonald
23b7ff95cd Simplify source by usuing autoconf
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@30692 72102866-910b-0410-8b05-ffd578937521
2010-06-12 07:19:26 +00:00
Riccardo Mottola
e574fe480c fix for defines of _XOPEN_SOURCE
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@30680 72102866-910b-0410-8b05-ffd578937521
2010-06-11 19:07:26 +00:00
Riccardo Mottola
462f5721ab change defines for GNU/HURD
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@30039 72102866-910b-0410-8b05-ffd578937521
2010-03-25 22:53:21 +00:00
Riccardo Mottola
19e49c3314 use proper _XOPEN_SOURCE instead of __USE_UNIX98 to enable needed thread features on glibc
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@29897 72102866-910b-0410-8b05-ffd578937521
2010-03-10 17:37:00 +00:00
Richard Frith-MacDonald
166f1afb4b build additions with NO_GNUSTEP=1
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@29771 72102866-910b-0410-8b05-ffd578937521
2010-02-26 08:39:47 +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
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
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
21e9e1231f Corrected last commit
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@29475 72102866-910b-0410-8b05-ffd578937521
2010-02-04 08:15:09 +00:00
Richard Frith-MacDonald
7f2d7d10eb Fixup bad indentation
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@29473 72102866-910b-0410-8b05-ffd578937521
2010-02-03 22:13:48 +00:00
Jonathan Gillaspie
d85c001251 Fix several problems with lockWhenCondition:beforeDate:
First -- it needs to use timeIntervalSince1970 to be using the same reference date required for pthread_cond_timedwait
Second -- lockWhenCondition needs to loop because pthread_cond_timedwait can return prior to delay expiring (but with the wrong condition).
Third -- Internally the lock was incorrectly being unlocked on a delayed acquire (and YES return).  And was incorrectly being unlocked a second time when the timeout expired.

Also, fixed a problem with tryLockWhenCondition:
By calling lockWhenCondition: it would incorrectly report a deadlock (rather than just return no) when we already have the lock.

All these changes are in line with expected and documented behavior for NSLock.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@29472 72102866-910b-0410-8b05-ffd578937521
2010-02-03 21:15:03 +00:00
Richard Frith-MacDonald
19796a1465 Documentation generation improvments
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@29047 72102866-910b-0410-8b05-ffd578937521
2009-11-23 09:42:18 +00:00
Richard Frith-MacDonald
c0f76095d1 BOOL must be YES or NO
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@28754 72102866-910b-0410-8b05-ffd578937521
2009-09-30 20:12:14 +00:00
David Chisnall
1874665069 Fixed bug in -lockWhenCondition:beforeDate: (was not releasing mutex correctly).
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@28752 72102866-910b-0410-8b05-ffd578937521
2009-09-30 12:40:00 +00:00
Richard Frith-MacDonald
6b1b12123a Small bugfixes and OSX compatibility tweak.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@28616 72102866-910b-0410-8b05-ffd578937521
2009-09-06 14:37:07 +00:00
Richard Frith-MacDonald
d626a852e5 Fix wrong version commit
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@28613 72102866-910b-0410-8b05-ffd578937521
2009-09-06 11:02:57 +00:00
Richard Frith-MacDonald
418330b29d Avoid exposing pthread details in NSLock.h (as much as possible without
impacting performance).


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@28612 72102866-910b-0410-8b05-ffd578937521
2009-09-06 10:56:04 +00:00
Richard Frith-MacDonald
b4ddaee78f Minor fixes/tweaks
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@28605 72102866-910b-0410-8b05-ffd578937521
2009-09-03 09:45:23 +00:00
David Chisnall
0e49e6e9fb Removed bonus semicolon added in earlier commit.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@28603 72102866-910b-0410-8b05-ffd578937521
2009-09-02 22:15:05 +00:00
David Chisnall
28618978db Fixed bug noticed by Fred.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@28602 72102866-910b-0410-8b05-ffd578937521
2009-09-02 22:13:48 +00:00
David Chisnall
39c9ec5afd Fixed typo pointed out by Philippe Roussel.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@28600 72102866-910b-0410-8b05-ffd578937521
2009-09-02 16:07:00 +00:00
David Chisnall
a9639aa3fa Added fix for error reported by Philippe Roussel on GNU/Linux.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@28599 72102866-910b-0410-8b05-ffd578937521
2009-09-02 14:47:16 +00:00
David Chisnall
d7a877b871 * Source/NSLock.m
* Headers/Foundation/NSLock.h
	Completely rewritten implementations of NSLock.h classes.  These are now
	faster, more complete, OS X-compatible, and most importantly actually
	work.  The old ones, for example, called functions that were not
	implemented on Windows.  
	* Source/NSThread.m
	Call pthread functions directly in NSThread instead of via the libobjc
	abstraction layer.  Also fixed a few issues, such as GC not being
	initialized properly for NSThread subclasses that override -main (Javaism
	supported by OS X) and tidies up the code in several places, removing
	premature optimizations, especially those that introduce a test for an
	unlikely case at the start of a method and thus slow everything down.

	As a result of this change, GNUstep now depends on an implementation of
	POSIX threads.  This is included as standard on all modern UNIX systems,
	and as an option on less-modern UNIX systems and non-UNIX systems,
	including Windows.  If you are building GNUstep on Windows, please install
	the pthreads-win32 package, available from:

	http://sourceware.org/pthreads-win32/

	PLEASE TEST THIS!  There may be some code that depended on the old
	behaviour.  I have been running the new NSLock implementation on FreeBSD
	for a few weeks without issue; please report to me any problems that you
	have on your platform.



git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@28598 72102866-910b-0410-8b05-ffd578937521
2009-09-02 13:03:13 +00:00
Gregory John Casamento
d2015542c0 Move NSLog to NSDebugLog for the WARNING.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@28203 72102866-910b-0410-8b05-ffd578937521
2009-04-11 05:13:33 +00:00