OpenClonk
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

◆ changed

- (void) changed

Definition at line 71 of file StdSchedulerMac.mm.

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

Referenced by StdScheduler::Changed().

Here is the caller graph for this function:

◆ initWithProc:

- (id) initWithProc: (StdSchedulerProc*)  _proc

Definition at line 71 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

◆ registerAt:

- (void) registerAt: (SCHAdditions*)  _additions

Reimplemented from SCHAddition.

Definition at line 231 of file StdSchedulerMac.mm.

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 }
virtual void GetFDs(std::vector< struct pollfd > &)
Definition: StdScheduler.h:72
__weak NSRunLoop * runLoop
list< pair< CFRunLoopSourceRef, CFSocketRef > > socketSources

References StdSchedulerProc::Execute(), SCHAddition::proc, s, and SCHAddition::shouldExecuteProc.

Here is the call graph for this function:

◆ shouldExecuteProc

- (bool) shouldExecuteProc

Definition at line 71 of file StdSchedulerMac.mm.

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

Referenced by registerAt:.

Here is the caller graph for this function:

◆ unregisterFrom:

- (void) unregisterFrom: (SCHAdditions*)  _additions

Reimplemented from SCHAddition.

Definition at line 231 of file StdSchedulerMac.mm.

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 }

Member Data Documentation

◆ proc

- (StdSchedulerProc*) proc
protectedinherited

Definition at line 28 of file StdSchedulerMac.mm.

Referenced by registerAt:.

◆ schedulerAdditions

- (__weak SCHAdditions*) schedulerAdditions
protectedinherited

Definition at line 27 of file StdSchedulerMac.mm.

◆ socketSources

- (list<pair<CFRunLoopSourceRef, CFSocketRef> >) socketSources
protected

Definition at line 39 of file StdSchedulerMac.mm.


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