ObjFW  Check-in [be7d619b6e]

Overview
Comment:Pass the timer as argument in timer blocks.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: be7d619b6e923d2fa638756614a8a6272e0b578c3b26ac132e8787c2aba0f308
User & Date: js on 2012-09-17 06:58:33
Other Links: manifest | tags
Context
2012-09-17
06:59
Only schedule valid timers for repeating. check-in: 6673513f33 user: js tags: trunk
06:58
Pass the timer as argument in timer blocks. check-in: be7d619b6e user: js tags: trunk
06:43
Don't create unnecessary run loops. check-in: 664e7d85cc user: js tags: trunk
Changes

Modified src/OFTCPSocket.m from [5b45773966] to [2a9dc1d700].

305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
		OFTimer *timer;

		[s connectToHost: host
			    port: port];

		timer = [OFTimer timerWithTimeInterval: 0
					       repeats: NO
						 block: ^ {
			[connectThread join];
			block(s);
		}];
		[runLoop addTimer: timer];

		objc_autoreleasePoolPop(pool2);








|







305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
		OFTimer *timer;

		[s connectToHost: host
			    port: port];

		timer = [OFTimer timerWithTimeInterval: 0
					       repeats: NO
						 block: ^ (OFTimer *unused) {
			[connectThread join];
			block(s);
		}];
		[runLoop addTimer: timer];

		objc_autoreleasePoolPop(pool2);

Modified src/OFTimer.h from [98ed7e03b4] to [c48810ddb2].

12
13
14
15
16
17
18




19
20
21
22
23
24
25
26
27
28
29
30
31
 * Public License, either version 2 or 3, which can be found in the file
 * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
 * file.
 */

#import "OFObject.h"





#ifdef OF_HAVE_BLOCKS
typedef void (^of_timer_block_t)(void);
#endif

@class OFDate;
@class OFCondition;

/**
 * \brief A class for creating and firing timers.
 */
@interface OFTimer: OFObject <OFComparing>
{
	OFDate *fireDate;







>
>
>
>

|

<
<
<







12
13
14
15
16
17
18
19
20
21
22
23
24
25



26
27
28
29
30
31
32
 * Public License, either version 2 or 3, which can be found in the file
 * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
 * file.
 */

#import "OFObject.h"

@class OFTimer;
@class OFDate;
@class OFCondition;

#ifdef OF_HAVE_BLOCKS
typedef void (^of_timer_block_t)(OFTimer*);
#endif




/**
 * \brief A class for creating and firing timers.
 */
@interface OFTimer: OFObject <OFComparing>
{
	OFDate *fireDate;

Modified src/OFTimer.m from [71481b674a] to [adae929703].

341
342
343
344
345
346
347
348
349
350
351
352
353
354
355

- (void)fire
{
	OF_ENSURE(arguments >= 0 && arguments <= 2);

#ifdef OF_HAVE_BLOCKS
	if (block != NULL)
		block();
	else {
#endif
		switch (arguments) {
		case 0:
			[target performSelector: selector];
			break;
		case 1:







|







341
342
343
344
345
346
347
348
349
350
351
352
353
354
355

- (void)fire
{
	OF_ENSURE(arguments >= 0 && arguments <= 2);

#ifdef OF_HAVE_BLOCKS
	if (block != NULL)
		block(self);
	else {
#endif
		switch (arguments) {
		case 0:
			[target performSelector: selector];
			break;
		case 1: