Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 138 lines (88 sloc) 5.075 kB
5135f23 Updated file header to include new contributor name
Peter Baumgartner authored
1 /*
614486a Initial draft for iMedia2. This is very much in an experimental stage…
Peter Baumgartner authored
2 iMedia Browser Framework <http://karelia.com/imedia/>
3
5721575 @danwood Noticed formatting on license prelude was wonky in some files. so I f…
danwood authored
4 Copyright (c) 2005-2012 by Karelia Software et al.
614486a Initial draft for iMedia2. This is very much in an experimental stage…
Peter Baumgartner authored
5
6 iMedia Browser is based on code originally developed by Jason Terhorst,
7 further developed for Sandvox by Greg Hulands, Dan Wood, and Terrence Talbot.
5135f23 Updated file header to include new contributor name
Peter Baumgartner authored
8 The new architecture for version 2.0 was developed by Peter Baumgartner.
614486a Initial draft for iMedia2. This is very much in an experimental stage…
Peter Baumgartner authored
9 Contributions have also been made by Matt Gough, Martin Wennerberg and others
10 as indicated in source files.
11
12 The iMedia Browser Framework is licensed under the following terms:
13
14 Permission is hereby granted, free of charge, to any person obtaining a copy
15 of this software and associated documentation files (the "Software"), to deal
16 in all or substantial portions of the Software without restriction, including
17 without limitation the rights to use, copy, modify, merge, publish,
18 distribute, sublicense, and/or sell copies of the Software, and to permit
19 persons to whom the Software is furnished to do so, subject to the following
20 conditions:
21
22 Redistributions of source code must retain the original terms stated here,
23 including this list of conditions, the disclaimer noted below, and the
5721575 @danwood Noticed formatting on license prelude was wonky in some files. so I f…
danwood authored
24 following copyright notice: Copyright (c) 2005-2012 by Karelia Software et al.
614486a Initial draft for iMedia2. This is very much in an experimental stage…
Peter Baumgartner authored
25
26 Redistributions in binary form must include, in an end-user-visible manner,
27 e.g., About window, Acknowledgments window, or similar, either a) the original
28 terms stated here, including this list of conditions, the disclaimer noted
29 below, and the aforementioned copyright notice, or b) the aforementioned
30 copyright notice and a link to karelia.com/imedia.
31
32 Neither the name of Karelia Software, nor Sandvox, nor the names of
33 contributors to iMedia Browser may be used to endorse or promote products
34 derived from the Software without prior and express written permission from
35 Karelia Software or individual contributors, as appropriate.
36
37 Disclaimer: THE SOFTWARE IS PROVIDED BY THE COPYRIGHT OWNER AND CONTRIBUTORS
38 "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
39 LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE,
40 AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
41 LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER LIABILITY, WHETHER IN AN ACTION OF
42 CONTRACT, TORT, OR OTHERWISE, ARISING FROM, OUT OF, OR IN CONNECTION WITH, THE
43 SOFTWARE OR THE USE OF, OR OTHER DEALINGS IN, THE SOFTWARE.
44 */
45
519de1b • All images in the NSSegmentControl of an IMBObjectController are no…
Peter Baumgartner authored
46
135075f Added an author line in the header of each source file. This is done …
Peter Baumgartner authored
47 // Author: Peter Baumgartner
48
49
614486a Initial draft for iMedia2. This is very much in an experimental stage…
Peter Baumgartner authored
50 //----------------------------------------------------------------------------------------------------------------------
51
519de1b • All images in the NSSegmentControl of an IMBObjectController are no…
Peter Baumgartner authored
52
614486a Initial draft for iMedia2. This is very much in an experimental stage…
Peter Baumgartner authored
53 #pragma mark HEADERS
54
55 #import "IMBOperationQueue.h"
56
519de1b • All images in the NSSegmentControl of an IMBObjectController are no…
Peter Baumgartner authored
57
614486a Initial draft for iMedia2. This is very much in an experimental stage…
Peter Baumgartner authored
58 //----------------------------------------------------------------------------------------------------------------------
59
519de1b • All images in the NSSegmentControl of an IMBObjectController are no…
Peter Baumgartner authored
60
614486a Initial draft for iMedia2. This is very much in an experimental stage…
Peter Baumgartner authored
61 #pragma mark CONSTANTS
62
63 // This constant controls how wide the queue will be, i.e. how many threads are running concurrently. More threads
64 // will lead to better load balancing, but it also increases the risk of resource contention. For example, if lot's
65 // of threads are doing file I/O, then the disk is seeking around like crazy, and alle threads are being slowed down.
66 // In this case a narrow serial queue would achieve better file I/O throughput. Change this constant to find the
67 // optimum middle ground for a wide variety of different machines...
68
69 const NSInteger kMaxConcurrentOperationCount = 4;
70
519de1b • All images in the NSSegmentControl of an IMBObjectController are no…
Peter Baumgartner authored
71
614486a Initial draft for iMedia2. This is very much in an experimental stage…
Peter Baumgartner authored
72 //----------------------------------------------------------------------------------------------------------------------
73
519de1b • All images in the NSSegmentControl of an IMBObjectController are no…
Peter Baumgartner authored
74
614486a Initial draft for iMedia2. This is very much in an experimental stage…
Peter Baumgartner authored
75 #pragma mark GLOBALS
76
77 static IMBOperationQueue* sSharedQueue = nil;
78
519de1b • All images in the NSSegmentControl of an IMBObjectController are no…
Peter Baumgartner authored
79
614486a Initial draft for iMedia2. This is very much in an experimental stage…
Peter Baumgartner authored
80 //----------------------------------------------------------------------------------------------------------------------
81
519de1b • All images in the NSSegmentControl of an IMBObjectController are no…
Peter Baumgartner authored
82
614486a Initial draft for iMedia2. This is very much in an experimental stage…
Peter Baumgartner authored
83 #pragma mark
84
85 @implementation IMBOperationQueue
86
519de1b • All images in the NSSegmentControl of an IMBObjectController are no…
Peter Baumgartner authored
87
614486a Initial draft for iMedia2. This is very much in an experimental stage…
Peter Baumgartner authored
88 //----------------------------------------------------------------------------------------------------------------------
89
519de1b • All images in the NSSegmentControl of an IMBObjectController are no…
Peter Baumgartner authored
90
614486a Initial draft for iMedia2. This is very much in an experimental stage…
Peter Baumgartner authored
91 // Creates a shared operation queue that can be accessed from anywhere in the iMedia.framework. Any operations that
92 // are added to this queue are executed in background threads. For this reason these operations should never modify
93 // any data structures that are already owned by controllers in the main thread (e.g.model objects that are used by
94 // bindings)...
95
96 + (IMBOperationQueue*) sharedQueue
97 {
98 @synchronized(self)
99 {
100 if (sSharedQueue == nil)
101 {
102 sSharedQueue = [[IMBOperationQueue alloc] init];
6350b30 @danwood Preliminary combo view with asynchronous loading.
danwood authored
103
519de1b • All images in the NSSegmentControl of an IMBObjectController are no…
Peter Baumgartner authored
104 #ifdef DEBUG
224057c Changed debug build to also use 4 threads for background queue, to br…
Peter Baumgartner authored
105 sSharedQueue.maxConcurrentOperationCount = kMaxConcurrentOperationCount;
519de1b • All images in the NSSegmentControl of an IMBObjectController are no…
Peter Baumgartner authored
106 #else
107 sSharedQueue.maxConcurrentOperationCount = kMaxConcurrentOperationCount;
108 #endif
614486a Initial draft for iMedia2. This is very much in an experimental stage…
Peter Baumgartner authored
109 }
110 }
111
112 return sSharedQueue;
113 }
114
519de1b • All images in the NSSegmentControl of an IMBObjectController are no…
Peter Baumgartner authored
115
614486a Initial draft for iMedia2. This is very much in an experimental stage…
Peter Baumgartner authored
116 //----------------------------------------------------------------------------------------------------------------------
117
519de1b • All images in the NSSegmentControl of an IMBObjectController are no…
Peter Baumgartner authored
118
614486a Initial draft for iMedia2. This is very much in an experimental stage…
Peter Baumgartner authored
119 // Suspend or resume the execution of background operations. This may be useful for some application to suppress high
120 // CPU load at certain times...
121
122 - (void) suspend
123 {
124 [self setSuspended:YES];
125 }
126
519de1b • All images in the NSSegmentControl of an IMBObjectController are no…
Peter Baumgartner authored
127
614486a Initial draft for iMedia2. This is very much in an experimental stage…
Peter Baumgartner authored
128 - (void) resume
129 {
130 [self setSuspended:NO];
131 }
132
519de1b • All images in the NSSegmentControl of an IMBObjectController are no…
Peter Baumgartner authored
133
614486a Initial draft for iMedia2. This is very much in an experimental stage…
Peter Baumgartner authored
134 //----------------------------------------------------------------------------------------------------------------------
135
519de1b • All images in the NSSegmentControl of an IMBObjectController are no…
Peter Baumgartner authored
136
614486a Initial draft for iMedia2. This is very much in an experimental stage…
Peter Baumgartner authored
137 @end
Something went wrong with that request. Please try again.