Search the list idList for an element with identifier ID. If found, its associated _pthread_v pointer is returned, otherwise NULL. NOTE: This method is not locked. */
| 125 | NULL. |
| 126 | NOTE: This method is not locked. */ |
| 127 | static struct _pthread_v * |
| 128 | __pthread_get_pointer (pthread_t id) |
| 129 | { |
| 130 | size_t l, r, p; |
| 131 | if (!idListCnt) |
| 132 | return NULL; |
| 133 | if (idListCnt == 1) |
| 134 | return (idList[0].id == id ? idList[0].ptr : NULL); |
| 135 | l = 0; r = idListCnt - 1; |
| 136 | while (l <= r) |
| 137 | { |
| 138 | p = (l + r) >> 1; |
| 139 | if (idList[p].id == id) |
| 140 | return idList[p].ptr; |
| 141 | else if (idList[p].id > id) |
| 142 | { |
| 143 | if (p == l) |
| 144 | return NULL; |
| 145 | r = p - 1; |
| 146 | } |
| 147 | else |
| 148 | { |
| 149 | l = p + 1; |
| 150 | } |
| 151 | } |
| 152 | |
| 153 | return NULL; |
| 154 | } |
| 155 | |
| 156 | static void |
| 157 | __pth_remove_use_for_key (pthread_key_t key) |
no outgoing calls
no test coverage detected