OpenClonk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
SCHNotify Class Reference
Inheritance diagram for SCHNotify:
[legend]
Collaboration diagram for SCHNotify:
[legend]

Instance Methods

(void) - registerAt:
 
(void) - unregisterFrom:
 
(id) - initWithProc:
 
(bool) - shouldExecuteProc
 
(void) - changed
 

Protected Attributes

list< pair< CFRunLoopSourceRef,
CFSocketRef > > 
socketSources
 
__weak SCHAdditionsschedulerAdditions
 
StdSchedulerProcproc
 

Detailed Description

Definition at line 37 of file StdSchedulerMac.mm.

Method Documentation

- (void) changed

Definition at line 193 of file StdSchedulerMac.mm.

References SCHAdditions::changed:, and SCHAddition::schedulerAdditions.

Referenced by StdScheduler::Changed().

194 {
195  [schedulerAdditions changed:self];
196 }

Here is the call graph for this function:

Here is the caller graph for this function:

- (id) initWithProc: (StdSchedulerProc*)  _proc

Definition at line 169 of file StdSchedulerMac.mm.

169  :(StdSchedulerProc *) _proc
170 {
171  if (self = [super init])
172  {
173  proc = _proc;
174  return self;
175  } else
176  return nil;
177 }
StdSchedulerProc * proc
- (void) registerAt: (SCHAdditions*)  _additions

Reimplemented from SCHAddition.

Definition at line 238 of file StdSchedulerMac.mm.

References StdSchedulerProc::GetFDs(), SCHAddition::registerAt:, SCHAdditions::runLoop, and socketSources.

238  :(SCHAdditions*) _additions
239 {
240  [super registerAt:_additions];
241  vector<struct pollfd> vecs;
242  proc->GetFDs(vecs);
243  CFSocketContext ctx =
244  {
245  .info = (__bridge void*)self,
246  .retain = CFRetain,
247  .release = CFRelease
248  };
249  for (auto p : vecs)
250  {
251  auto socket = CFSocketCreateWithNative(NULL,
252  p.fd, kCFSocketReadCallBack,
253  callback, &ctx
254  );
255  auto runLoopSource = CFSocketCreateRunLoopSource(NULL, socket, 0);
256  CFRunLoopAddSource([_additions.runLoop getCFRunLoop], runLoopSource, kCFRunLoopDefaultMode);
257  socketSources.push_back(make_pair(runLoopSource, socket));
258  }
259 }
__weak NSRunLoop * runLoop
StdSchedulerProc * proc
virtual void GetFDs(std::vector< struct pollfd > &)
Definition: StdScheduler.h:72
list< pair< CFRunLoopSourceRef, CFSocketRef > > socketSources

Here is the call graph for this function:

- (bool) shouldExecuteProc

Definition at line 178 of file StdSchedulerMac.mm.

References s, and SCHAddition::schedulerAdditions.

179 {
180  if (!proc)
181  return false;
182  auto s = schedulerAdditions;
183  return s && !s.scheduler->IsInManualLoop();
184 }
__weak SCHAdditions * schedulerAdditions
StdSchedulerProc * proc
#define s
- (void) unregisterFrom: (SCHAdditions*)  _additions

Reimplemented from SCHAddition.

Definition at line 260 of file StdSchedulerMac.mm.

References socketSources, and SCHAddition::unregisterFrom:.

260  :(SCHAdditions*) _additions
261 {
262  auto runLoop = [_additions.runLoop getCFRunLoop];
263  for (auto r : socketSources)
264  {
265  CFRunLoopRemoveSource(runLoop, r.first, kCFRunLoopDefaultMode);
266  CFSocketDisableCallBacks(r.second, kCFSocketReadCallBack|kCFSocketWriteCallBack);
267  CFRunLoopSourceInvalidate(r.first);
268  CFRelease(r.second);
269  CFRelease(r.first);
270  }
271  socketSources.clear();
272  [super unregisterFrom:_additions];
273 }
list< pair< CFRunLoopSourceRef, CFSocketRef > > socketSources

Here is the call graph for this function:

Member Data Documentation

- (StdSchedulerProc*) proc
protectedinherited

Definition at line 28 of file StdSchedulerMac.mm.

- (__weak SCHAdditions*) schedulerAdditions
protectedinherited
- (list<pair<CFRunLoopSourceRef, CFSocketRef> >) socketSources
protected

Definition at line 39 of file StdSchedulerMac.mm.

Referenced by registerAt:, and unregisterFrom:.


The documentation for this class was generated from the following file: