ObjFW  Check-in [2929f89f3e]

Overview
Comment:OFThread: Implement the OFCopying protocol.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 2929f89f3eccbd880071b801880ae5e31649444383c57b2f1dd3128056cf1fa4
User & Date: js on 2012-09-15 12:20:32
Other Links: manifest | tags
Context
2012-09-15
12:21
OFThread: Make the block the last argument. check-in: cf8db6867d user: js tags: trunk
12:20
OFThread: Implement the OFCopying protocol. check-in: 2929f89f3e user: js tags: trunk
2012-09-14
07:03
Create the current OFRunLoop on demand. check-in: 2193480a94 user: js tags: trunk
Changes

Modified src/OFStream.h from [d3c9a265b1] to [adf57753c4].

34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
typedef BOOL (^of_stream_async_read_line_block_t)(OFStream*, OFString*);
#endif

/**
 * \brief A base class for different types of streams.
 *
 * \warning Even though the OFCopying protocol is implemented, it does
 *	    <i>not</i> return an independent copy of the stream but instead
 *	    retains it.  This is so that the stream can be used as a key for a
 *	    dictionary, so context can be associated with a stream. Using a
 *	    stream in more than one thread at the same time is not thread-safe,
 *	    even if copy was called to create one "instance" for every thread!
 *
 * \warning If you want to subclass this, override _readIntoBuffer:length:,
 *	    _writeBuffer:length: and _isAtEndOfStream, but nothing else, as
 *	    those are are the methods that do the actual work. OFStream uses







|
|







34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
typedef BOOL (^of_stream_async_read_line_block_t)(OFStream*, OFString*);
#endif

/**
 * \brief A base class for different types of streams.
 *
 * \warning Even though the OFCopying protocol is implemented, it does
 *	    <i>not</i> return an independent copy of the stream, but instead
 *	    retains it. This is so that the stream can be used as a key for a
 *	    dictionary, so context can be associated with a stream. Using a
 *	    stream in more than one thread at the same time is not thread-safe,
 *	    even if copy was called to create one "instance" for every thread!
 *
 * \warning If you want to subclass this, override _readIntoBuffer:length:,
 *	    _writeBuffer:length: and _isAtEndOfStream, but nothing else, as
 *	    those are are the methods that do the actual work. OFStream uses

Modified src/OFThread.h from [2e194b355b] to [c69b3187df].

71
72
73
74
75
76
77





78
79
80
81
82
83
84
85
86
@end

/**
 * \brief A class which provides portable threads.
 *
 * To use it, you should create a new class derived from it and reimplement
 * main.





 */
@interface OFThread: OFObject
{
#ifdef OF_THREAD_M
@public
#endif
	id object;
#ifndef OF_THREAD_M
@private







>
>
>
>
>

|







71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
@end

/**
 * \brief A class which provides portable threads.
 *
 * To use it, you should create a new class derived from it and reimplement
 * main.
 *
 * \warning Even though the OFCopying protocol is implemented, it does
 *	    <i>not</i> return an independent copy of the thread, but instead
 *	    retains it. This is so that the thread can be used as a key for a
 *	    dictionary, so context can be associated with a thread.
 */
@interface OFThread: OFObject <OFCopying>
{
#ifdef OF_THREAD_M
@public
#endif
	id object;
#ifndef OF_THREAD_M
@private

Modified src/OFThread.m from [984a3e9ddd] to [eea4c563b1].

355
356
357
358
359
360
361





362
363
364
365
366
367
368

	[object release];
	[returnValue release];
	[timersQueue release];

	[super dealloc];
}





@end

@implementation OFTLSKey
+ (void)initialize
{
	if (self == [OFTLSKey class])
		TLSKeys = [[OFList alloc] init];







>
>
>
>
>







355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373

	[object release];
	[returnValue release];
	[timersQueue release];

	[super dealloc];
}

- copy
{
	return [self retain];
}
@end

@implementation OFTLSKey
+ (void)initialize
{
	if (self == [OFTLSKey class])
		TLSKeys = [[OFList alloc] init];