Trust uboot's device list only if it does not look suspicious.
[AROS.git] / test / taskstorage.c
blob66593f8cb5f934fd3aa90dbdc2af2784ca386b8e
1 #include <proto/exec.h>
2 #include <proto/dos.h>
4 #include <assert.h>
6 static BPTR out;
7 static LONG slot1, slot2, slot3;
9 static void printslot1(void)
11 FPrintf(out, "Value slot %ld: %ld\n", slot1, GetTaskStorageSlot(slot1));
14 int main(void)
16 out = Output();
18 slot1 = AllocTaskStorageSlot();
19 FPrintf(out, "Got slot %ld\n", slot1);
21 slot2 = AllocTaskStorageSlot();
22 FPrintf(out, "Got slot %ld\n", slot2);
24 FreeTaskStorageSlot(slot2);
25 FPrintf(out, "Freed slot %ld\n", slot2);
27 slot2 = AllocTaskStorageSlot();
28 FPrintf(out, "Got slot %ld\n", slot2);
30 slot3 = AllocTaskStorageSlot();
31 FPrintf(out, "Got slot %ld\n", slot3);
33 SetTaskStorageSlot(slot1, 69);
34 FPrintf(out, "Stored value 69 in slot %ld\n", slot1);
36 FPrintf(out, "Checking value in subtask\n");
37 struct Process *proc =
38 CreateNewProcTags(
39 NP_Entry, printslot1, NP_Name, "Check slot1",
40 NP_Synchronous, TRUE, TAG_DONE
42 assert(proc != NULL);
44 FreeTaskStorageSlot(slot1);
45 FPrintf(out, "Freed slot %ld\n", slot1);
47 slot1 = AllocTaskStorageSlot();
48 FPrintf(out, "Got slot %ld\n", slot1);
50 FreeTaskStorageSlot(slot2);
51 FPrintf(out, "Freed slot %ld\n", slot2);
53 FreeTaskStorageSlot(slot1);
54 FPrintf(out, "Freed slot %ld\n", slot1);
56 FreeTaskStorageSlot(slot3);
57 FPrintf(out, "Freed slot %ld\n", slot3);
59 return 0;