ObjFW  Check-in [9e60532254]

Overview
Comment:threading: Get rid of warnings with old compilers
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 9e605322543843cfcb8d4197e17a13a05fed739cfca8aee9844933c08f462c99
User & Date: js on 2014-07-23 19:34:46
Other Links: manifest | tags
Context
2014-07-23
23:09
threading: Prevent possible division by zero check-in: 90f2f05c2c user: js tags: trunk
19:34
threading: Get rid of warnings with old compilers check-in: 9e60532254 user: js tags: trunk
2014-07-19
16:27
OFThread: Configurable priority and stack size check-in: c4f724070a user: js tags: trunk
Changes

Modified src/threading_pthread.m from [9c2b4d74c8] to [cdf397d0df].

36
37
38
39
40
41
42
43
44
45
46
47


48
49
50
51
52
53

54
55
56
57
58
59
60
			return false;

		attr->priority = (float)(param.sched_priority - minPrio) /
		    (maxPrio - minPrio);

		if (pthread_attr_getstacksize(&pattr, &attr->stackSize) != 0)
			return false;

		return true;
	} @finally {
		pthread_attr_destroy(&pattr);
	}


}

bool
of_thread_new(of_thread_t *thread, id (*function)(id), id data,
    const of_thread_attr_t *attr)
{

	pthread_attr_t pattr;

	if (pthread_attr_init(&pattr) != 0)
		return false;

	@try {
		if (attr != NULL) {







<
<



>
>






>







36
37
38
39
40
41
42


43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
			return false;

		attr->priority = (float)(param.sched_priority - minPrio) /
		    (maxPrio - minPrio);

		if (pthread_attr_getstacksize(&pattr, &attr->stackSize) != 0)
			return false;


	} @finally {
		pthread_attr_destroy(&pattr);
	}

	return true;
}

bool
of_thread_new(of_thread_t *thread, id (*function)(id), id data,
    const of_thread_attr_t *attr)
{
	bool ret;
	pthread_attr_t pattr;

	if (pthread_attr_init(&pattr) != 0)
		return false;

	@try {
		if (attr != NULL) {
81
82
83
84
85
86
87
88
89
90
91
92


93
94
95
96
97
98
99
				return false;

			if (pthread_attr_setstacksize(&pattr,
			    attr->stackSize) != 0)
				return false;
		}

		return (pthread_create(thread, &pattr,
		    (void*(*)(void*))function, (__bridge void*)data) == 0);
	} @finally {
		pthread_attr_destroy(&pattr);
	}


}

bool
of_thread_join(of_thread_t thread)
{
	void *ret;








|




>
>







82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
				return false;

			if (pthread_attr_setstacksize(&pattr,
			    attr->stackSize) != 0)
				return false;
		}

		ret = (pthread_create(thread, &pattr,
		    (void*(*)(void*))function, (__bridge void*)data) == 0);
	} @finally {
		pthread_attr_destroy(&pattr);
	}

	return ret;
}

bool
of_thread_join(of_thread_t thread)
{
	void *ret;