ObjFW  Check-in [10c3b59143]

Overview
Comment:Reduce locking in class_conformsToProtocol().
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | runtime
Files: files | file ages | folders
SHA3-256: 10c3b59143bcca8b7d7e33189c4ce3b440e285122fe3151c57abea3a32f940fb
User & Date: js on 2012-04-08 14:07:59
Other Links: branch diff | manifest | tags
Context
2012-04-08
14:14
Add protocol_{getName,isEqual,conformsToProtocol}. check-in: b8744d8d68 user: js tags: runtime
14:07
Reduce locking in class_conformsToProtocol(). check-in: 10c3b59143 user: js tags: runtime
14:06
Don't have any methods in Protocol. check-in: df24f80ab0 user: js tags: runtime
Changes

Modified src/runtime/protocol.m from [1e751e9c03] to [c0d1405d27].

27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43

44
45
46
47
48
49
50
BOOL
class_conformsToProtocol(Class cls, Protocol *p)
{
	struct objc_protocol_list *pl;
	struct objc_category **cats;
	long i, j;

	objc_global_mutex_lock();

	for (pl = cls->protocols; pl != NULL; pl = pl->next) {
		for (i = 0; i < pl->count; i++) {
			if (!strcmp(pl->list[i]->name, p->name)) {
				objc_global_mutex_unlock();
				return YES;
			}
		}
	}


	if ((cats = objc_categories_for_class(cls)) == NULL) {
		objc_global_mutex_unlock();
		return NO;
	}

	for (i = 0; cats[i] != NULL; i++) {







<
<


|
<

|
|
|
>







27
28
29
30
31
32
33


34
35
36

37
38
39
40
41
42
43
44
45
46
47
48
BOOL
class_conformsToProtocol(Class cls, Protocol *p)
{
	struct objc_protocol_list *pl;
	struct objc_category **cats;
	long i, j;



	for (pl = cls->protocols; pl != NULL; pl = pl->next) {
		for (i = 0; i < pl->count; i++) {
			if (!strcmp(pl->list[i]->name, p->name))

				return YES;
		}
	}

	objc_global_mutex_lock();

	if ((cats = objc_categories_for_class(cls)) == NULL) {
		objc_global_mutex_unlock();
		return NO;
	}

	for (i = 0; cats[i] != NULL; i++) {