Mercurial > almixer_isolated
annotate LinkedList.h @ 44:56855942fdc6
Split off background thread (threads only) termination and creation into separate functions from Interruption handling to make it easier to avoid race condition bug with Apple rdar://10081775 w.r.t. setting the OpenAL context. New APIs to suspend and resume update threads. Interruption handling calls these automatically.
Also partially regressed simplification with regards to getting the current playing state in the main update loop.
author | Eric Wing <ewing@anscamobile.com> |
---|---|
date | Tue, 13 Sep 2011 18:03:21 -0700 |
parents | a8d96c934e77 |
children | 516da6d93534 |
rev | line source |
---|---|
18
7877c2e18768
Accidentally overwrote LinkedList.h file with .c file
Eric Wing <ewing . public |-at-| gmail . com>
parents:
17
diff
changeset
|
1 /* |
7877c2e18768
Accidentally overwrote LinkedList.h file with .c file
Eric Wing <ewing . public |-at-| gmail . com>
parents:
17
diff
changeset
|
2 LinkedList |
7877c2e18768
Accidentally overwrote LinkedList.h file with .c file
Eric Wing <ewing . public |-at-| gmail . com>
parents:
17
diff
changeset
|
3 Copyright (C) 2010 Eric Wing <ewing . public @ playcontrol.net> |
7877c2e18768
Accidentally overwrote LinkedList.h file with .c file
Eric Wing <ewing . public |-at-| gmail . com>
parents:
17
diff
changeset
|
4 |
7877c2e18768
Accidentally overwrote LinkedList.h file with .c file
Eric Wing <ewing . public |-at-| gmail . com>
parents:
17
diff
changeset
|
5 This library is free software; you can redistribute it and/or |
7877c2e18768
Accidentally overwrote LinkedList.h file with .c file
Eric Wing <ewing . public |-at-| gmail . com>
parents:
17
diff
changeset
|
6 modify it under the terms of the GNU Library General Public |
7877c2e18768
Accidentally overwrote LinkedList.h file with .c file
Eric Wing <ewing . public |-at-| gmail . com>
parents:
17
diff
changeset
|
7 License as published by the Free Software Foundation; either |
7877c2e18768
Accidentally overwrote LinkedList.h file with .c file
Eric Wing <ewing . public |-at-| gmail . com>
parents:
17
diff
changeset
|
8 version 2 of the License, or (at your option) any later version. |
7877c2e18768
Accidentally overwrote LinkedList.h file with .c file
Eric Wing <ewing . public |-at-| gmail . com>
parents:
17
diff
changeset
|
9 |
7877c2e18768
Accidentally overwrote LinkedList.h file with .c file
Eric Wing <ewing . public |-at-| gmail . com>
parents:
17
diff
changeset
|
10 This library is distributed in the hope that it will be useful, |
7877c2e18768
Accidentally overwrote LinkedList.h file with .c file
Eric Wing <ewing . public |-at-| gmail . com>
parents:
17
diff
changeset
|
11 but WITHOUT ANY WARRANTY; without even the implied warranty of |
7877c2e18768
Accidentally overwrote LinkedList.h file with .c file
Eric Wing <ewing . public |-at-| gmail . com>
parents:
17
diff
changeset
|
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
7877c2e18768
Accidentally overwrote LinkedList.h file with .c file
Eric Wing <ewing . public |-at-| gmail . com>
parents:
17
diff
changeset
|
13 Library General Public License for more details. |
7877c2e18768
Accidentally overwrote LinkedList.h file with .c file
Eric Wing <ewing . public |-at-| gmail . com>
parents:
17
diff
changeset
|
14 |
7877c2e18768
Accidentally overwrote LinkedList.h file with .c file
Eric Wing <ewing . public |-at-| gmail . com>
parents:
17
diff
changeset
|
15 You should have received a copy of the GNU Library General Public |
7877c2e18768
Accidentally overwrote LinkedList.h file with .c file
Eric Wing <ewing . public |-at-| gmail . com>
parents:
17
diff
changeset
|
16 License along with this library; if not, write to the Free |
7877c2e18768
Accidentally overwrote LinkedList.h file with .c file
Eric Wing <ewing . public |-at-| gmail . com>
parents:
17
diff
changeset
|
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
7877c2e18768
Accidentally overwrote LinkedList.h file with .c file
Eric Wing <ewing . public |-at-| gmail . com>
parents:
17
diff
changeset
|
18 */ |
17
d58eb38c771b
Needed new Front and Back (non-popping) functions for LinkedList.
Eric Wing <ewing . public |-at-| gmail . com>
parents:
14
diff
changeset
|
19 |
18
7877c2e18768
Accidentally overwrote LinkedList.h file with .c file
Eric Wing <ewing . public |-at-| gmail . com>
parents:
17
diff
changeset
|
20 /* I'm so sick of constantly rewriting linked lists in C. |
7877c2e18768
Accidentally overwrote LinkedList.h file with .c file
Eric Wing <ewing . public |-at-| gmail . com>
parents:
17
diff
changeset
|
21 So here's some initial work to write a very simple reusable implementation. |
7877c2e18768
Accidentally overwrote LinkedList.h file with .c file
Eric Wing <ewing . public |-at-| gmail . com>
parents:
17
diff
changeset
|
22 The API could use a lot more functions, but I'll add them as I need them. |
7877c2e18768
Accidentally overwrote LinkedList.h file with .c file
Eric Wing <ewing . public |-at-| gmail . com>
parents:
17
diff
changeset
|
23 */ |
17
d58eb38c771b
Needed new Front and Back (non-popping) functions for LinkedList.
Eric Wing <ewing . public |-at-| gmail . com>
parents:
14
diff
changeset
|
24 |
18
7877c2e18768
Accidentally overwrote LinkedList.h file with .c file
Eric Wing <ewing . public |-at-| gmail . com>
parents:
17
diff
changeset
|
25 #ifndef C_LINKED_LIST_H |
7877c2e18768
Accidentally overwrote LinkedList.h file with .c file
Eric Wing <ewing . public |-at-| gmail . com>
parents:
17
diff
changeset
|
26 #define C_LINKED_LIST_H |
17
d58eb38c771b
Needed new Front and Back (non-popping) functions for LinkedList.
Eric Wing <ewing . public |-at-| gmail . com>
parents:
14
diff
changeset
|
27 |
18
7877c2e18768
Accidentally overwrote LinkedList.h file with .c file
Eric Wing <ewing . public |-at-| gmail . com>
parents:
17
diff
changeset
|
28 /* Set up for C function definitions, even when using C++ */ |
7877c2e18768
Accidentally overwrote LinkedList.h file with .c file
Eric Wing <ewing . public |-at-| gmail . com>
parents:
17
diff
changeset
|
29 #ifdef __cplusplus |
7877c2e18768
Accidentally overwrote LinkedList.h file with .c file
Eric Wing <ewing . public |-at-| gmail . com>
parents:
17
diff
changeset
|
30 extern "C" { |
7877c2e18768
Accidentally overwrote LinkedList.h file with .c file
Eric Wing <ewing . public |-at-| gmail . com>
parents:
17
diff
changeset
|
31 #endif |
17
d58eb38c771b
Needed new Front and Back (non-popping) functions for LinkedList.
Eric Wing <ewing . public |-at-| gmail . com>
parents:
14
diff
changeset
|
32 |
18
7877c2e18768
Accidentally overwrote LinkedList.h file with .c file
Eric Wing <ewing . public |-at-| gmail . com>
parents:
17
diff
changeset
|
33 #include <stddef.h> |
17
d58eb38c771b
Needed new Front and Back (non-popping) functions for LinkedList.
Eric Wing <ewing . public |-at-| gmail . com>
parents:
14
diff
changeset
|
34 |
18
7877c2e18768
Accidentally overwrote LinkedList.h file with .c file
Eric Wing <ewing . public |-at-| gmail . com>
parents:
17
diff
changeset
|
35 typedef struct LinkedListNode LinkedListNode; |
7877c2e18768
Accidentally overwrote LinkedList.h file with .c file
Eric Wing <ewing . public |-at-| gmail . com>
parents:
17
diff
changeset
|
36 typedef struct LinkedList LinkedList; |
7877c2e18768
Accidentally overwrote LinkedList.h file with .c file
Eric Wing <ewing . public |-at-| gmail . com>
parents:
17
diff
changeset
|
37 |
7877c2e18768
Accidentally overwrote LinkedList.h file with .c file
Eric Wing <ewing . public |-at-| gmail . com>
parents:
17
diff
changeset
|
38 LinkedList* LinkedList_Create(); |
17
d58eb38c771b
Needed new Front and Back (non-popping) functions for LinkedList.
Eric Wing <ewing . public |-at-| gmail . com>
parents:
14
diff
changeset
|
39 |
18
7877c2e18768
Accidentally overwrote LinkedList.h file with .c file
Eric Wing <ewing . public |-at-| gmail . com>
parents:
17
diff
changeset
|
40 void LinkedList_Free(LinkedList* linked_list); |
17
d58eb38c771b
Needed new Front and Back (non-popping) functions for LinkedList.
Eric Wing <ewing . public |-at-| gmail . com>
parents:
14
diff
changeset
|
41 |
18
7877c2e18768
Accidentally overwrote LinkedList.h file with .c file
Eric Wing <ewing . public |-at-| gmail . com>
parents:
17
diff
changeset
|
42 void* LinkedList_Front(LinkedList* linked_list); |
19
a8d96c934e77
Reverted linked list.
Eric Wing <ewing . public |-at-| gmail . com>
parents:
18
diff
changeset
|
43 |
18
7877c2e18768
Accidentally overwrote LinkedList.h file with .c file
Eric Wing <ewing . public |-at-| gmail . com>
parents:
17
diff
changeset
|
44 void* LinkedList_Back(LinkedList* linked_list); |
14
1c27a52c5b15
Added copyright.
Eric Wing <ewing . public |-at-| gmail . com>
parents:
13
diff
changeset
|
45 |
18
7877c2e18768
Accidentally overwrote LinkedList.h file with .c file
Eric Wing <ewing . public |-at-| gmail . com>
parents:
17
diff
changeset
|
46 unsigned int LinkedList_PushFront(LinkedList* linked_list, void* new_item); |
7877c2e18768
Accidentally overwrote LinkedList.h file with .c file
Eric Wing <ewing . public |-at-| gmail . com>
parents:
17
diff
changeset
|
47 |
7877c2e18768
Accidentally overwrote LinkedList.h file with .c file
Eric Wing <ewing . public |-at-| gmail . com>
parents:
17
diff
changeset
|
48 unsigned int LinkedList_PushBack(LinkedList* linked_list, void* new_item); |
17
d58eb38c771b
Needed new Front and Back (non-popping) functions for LinkedList.
Eric Wing <ewing . public |-at-| gmail . com>
parents:
14
diff
changeset
|
49 |
18
7877c2e18768
Accidentally overwrote LinkedList.h file with .c file
Eric Wing <ewing . public |-at-| gmail . com>
parents:
17
diff
changeset
|
50 void* LinkedList_PopFront(LinkedList* linked_list); |
17
d58eb38c771b
Needed new Front and Back (non-popping) functions for LinkedList.
Eric Wing <ewing . public |-at-| gmail . com>
parents:
14
diff
changeset
|
51 |
18
7877c2e18768
Accidentally overwrote LinkedList.h file with .c file
Eric Wing <ewing . public |-at-| gmail . com>
parents:
17
diff
changeset
|
52 void* LinkedList_PopBack(LinkedList* linked_list); |
13
54aa96ae8912
Added LinkedList class to project.
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff
changeset
|
53 |
18
7877c2e18768
Accidentally overwrote LinkedList.h file with .c file
Eric Wing <ewing . public |-at-| gmail . com>
parents:
17
diff
changeset
|
54 size_t LinkedList_Size(LinkedList* linked_list); |
7877c2e18768
Accidentally overwrote LinkedList.h file with .c file
Eric Wing <ewing . public |-at-| gmail . com>
parents:
17
diff
changeset
|
55 |
7877c2e18768
Accidentally overwrote LinkedList.h file with .c file
Eric Wing <ewing . public |-at-| gmail . com>
parents:
17
diff
changeset
|
56 void LinkedList_Clear(LinkedList* linked_list); |
13
54aa96ae8912
Added LinkedList class to project.
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff
changeset
|
57 |
18
7877c2e18768
Accidentally overwrote LinkedList.h file with .c file
Eric Wing <ewing . public |-at-| gmail . com>
parents:
17
diff
changeset
|
58 void* LinkedListNode_GetData(LinkedListNode* list_node); |
7877c2e18768
Accidentally overwrote LinkedList.h file with .c file
Eric Wing <ewing . public |-at-| gmail . com>
parents:
17
diff
changeset
|
59 |
7877c2e18768
Accidentally overwrote LinkedList.h file with .c file
Eric Wing <ewing . public |-at-| gmail . com>
parents:
17
diff
changeset
|
60 LinkedListNode* LinkedList_Find(LinkedList* linked_list, void* the_data, LinkedListNode* start_node); |
17
d58eb38c771b
Needed new Front and Back (non-popping) functions for LinkedList.
Eric Wing <ewing . public |-at-| gmail . com>
parents:
14
diff
changeset
|
61 |
18
7877c2e18768
Accidentally overwrote LinkedList.h file with .c file
Eric Wing <ewing . public |-at-| gmail . com>
parents:
17
diff
changeset
|
62 unsigned int LinkedList_Remove(LinkedList* linked_list, LinkedListNode* list_node); |
13
54aa96ae8912
Added LinkedList class to project.
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff
changeset
|
63 |
18
7877c2e18768
Accidentally overwrote LinkedList.h file with .c file
Eric Wing <ewing . public |-at-| gmail . com>
parents:
17
diff
changeset
|
64 /* Ends C function definitions when using C++ */ |
7877c2e18768
Accidentally overwrote LinkedList.h file with .c file
Eric Wing <ewing . public |-at-| gmail . com>
parents:
17
diff
changeset
|
65 #ifdef __cplusplus |
7877c2e18768
Accidentally overwrote LinkedList.h file with .c file
Eric Wing <ewing . public |-at-| gmail . com>
parents:
17
diff
changeset
|
66 } |
7877c2e18768
Accidentally overwrote LinkedList.h file with .c file
Eric Wing <ewing . public |-at-| gmail . com>
parents:
17
diff
changeset
|
67 #endif |
17
d58eb38c771b
Needed new Front and Back (non-popping) functions for LinkedList.
Eric Wing <ewing . public |-at-| gmail . com>
parents:
14
diff
changeset
|
68 |
18
7877c2e18768
Accidentally overwrote LinkedList.h file with .c file
Eric Wing <ewing . public |-at-| gmail . com>
parents:
17
diff
changeset
|
69 #endif /* C_LINKED_LIST_H */ |
13
54aa96ae8912
Added LinkedList class to project.
Eric Wing <ewing . public |-at-| gmail . com>
parents:
diff
changeset
|
70 |