amigamouse.hidd: Use the new inline mechanism
[AROS.git] / test / taskstorage.c
blob1d058eec507bb4c2c9d4c7658a1aa71f3b62fd70
1 #include <proto/exec.h>
2 #include <proto/dos.h>
4 #include <assert.h>
6 static BPTR out;
7 static int slot1, slot2, slot3;
9 static void printslot1(void)
11 struct ETask *etask = FindTask(NULL)->tc_UnionETask.tc_ETask;
13 FPrintf(out, "Value slot %ld: %ld\n", slot1, (int)etask->et_TaskStorage[slot1]);
16 int main(void)
18 struct ETask *etask = FindTask(NULL)->tc_UnionETask.tc_ETask;
20 out = Output();
22 slot1 = AllocTaskStorageSlot();
23 FPrintf(out, "Got slot %d\n", slot1);
25 slot2 = AllocTaskStorageSlot();
26 FPrintf(out, "Got slot %d\n", slot2);
28 FreeTaskStorageSlot(slot2);
29 FPrintf(out, "Freed slot %d\n", slot2);
31 slot2 = AllocTaskStorageSlot();
32 FPrintf(out, "Got slot %d\n", slot2);
34 slot3 = AllocTaskStorageSlot();
35 FPrintf(out, "Got slot %d\n", slot3);
37 etask->et_TaskStorage[slot1] = (IPTR)69;
38 FPrintf(out, "Stored value 69 in slot %d\n", slot1);
40 FPrintf(out, "Checking value in subtask\n");
41 struct Process *proc =
42 CreateNewProcTags(
43 NP_Entry, printslot1, NP_Name, "Check slot1",
44 NP_Synchronous, TRUE, TAG_DONE
46 assert(proc != NULL);
48 FreeTaskStorageSlot(slot1);
49 FPrintf(out, "Freed slot %d\n", slot1);
51 slot1 = AllocTaskStorageSlot();
52 FPrintf(out, "Got slot %d\n", slot1);
54 FreeTaskStorageSlot(slot2);
55 FPrintf(out, "Freed slot %d\n", slot2);
57 FreeTaskStorageSlot(slot1);
58 FPrintf(out, "Freed slot %d\n", slot1);
60 FreeTaskStorageSlot(slot3);
61 FPrintf(out, "Freed slot %d\n", slot3);
63 return 0;