Documented GVF_SAVE_VAR alongside other flags, and removed a query/doubt
[AROS.git] / arch / all-ios / hidd / uikit / eventtask.c
blobc62b4c92978594e702834380ece7bded4c9e0396
1 /*
2 Copyright © 1995-2014, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #define DEBUG 1
8 #include <aros/asmcall.h>
9 #include <aros/debug.h>
10 #include <dos/dos.h>
11 #include <hardware/intbits.h>
12 #include <proto/exec.h>
13 #include <proto/hostlib.h>
15 #include "classbase.h"
17 #ifdef __i386__
19 * MacOS X x86 ABI says that stack must be aligned at 16 bytes boundary.
20 * Some functions crash if this condition is not met. For example, CFRunLoopRunInMode()
21 * crashes deeply inside UIKit (CATimeWithHostTime() function).
22 * We add also noinline because gcc loves to inline such short functions, consequently
23 * omitting stack realignment.
24 * Unfortunately we can't do this on Darwin side. Darwin gcc simply ignores
25 * force_align_arg_pointer attribute. :(
27 #define __stackalign __attribute__((force_align_arg_pointer, noinline))
28 #else
29 #define __stackalign static inline
30 #endif
32 static AROS_INTH1(vblHandler, struct UIKitBase *,base)
34 AROS_INTFUNC_INIT
36 Signal(base->eventTask, base->eventMask);
37 return FALSE;
39 AROS_INTFUNC_EXIT
42 __stackalign void PollEvents(struct UIKitBase *base)
44 base->iface->PollEvents();
45 AROS_HOST_BARRIER
48 void EventTask(struct UIKitBase *base)
50 ULONG sigset;
51 LONG signal = AllocSignal(-1);
53 D(bug("[UIKit] Event poll task started, signal %d, base 0x%p\n", signal, base));
55 base->eventMask = 1 << signal;
56 base->eventInt.is_Node.ln_Name = "Cocoa Touch events poll";
57 base->eventInt.is_Code = (VOID_FUNC)vblHandler;
58 base->eventInt.is_Data = base;
60 AddIntServer(INTB_VERTB, &base->eventInt);
64 sigset = Wait(base->eventMask | SIGBREAKF_CTRL_C);
66 if (sigset & base->eventMask)
68 HostLib_Lock();
70 PollEvents(base);
72 HostLib_Unlock();
74 } while (!(sigset & SIGBREAKF_CTRL_C));
76 RemIntServer(INTB_VERTB, &base->eventInt);