| 1201 | } |
| 1202 | |
| 1203 | static int pthread_setspecific(pthread_key_t key, const void *value) |
| 1204 | { |
| 1205 | pthread_t t = pthread_self(); |
| 1206 | |
| 1207 | if (key > t->keymax) |
| 1208 | { |
| 1209 | int keymax = (key + 1) * 2; |
| 1210 | void **kv = (void**)realloc(t->keyval, keymax * sizeof(void *)); |
| 1211 | |
| 1212 | if (!kv) return ENOMEM; |
| 1213 | |
| 1214 | /* Clear new region */ |
| 1215 | memset(&kv[t->keymax], 0, (keymax - t->keymax)*sizeof(void*)); |
| 1216 | |
| 1217 | t->keyval = kv; |
| 1218 | t->keymax = keymax; |
| 1219 | } |
| 1220 | |
| 1221 | t->keyval[key] = (void *) value; |
| 1222 | |
| 1223 | return 0; |
| 1224 | } |
| 1225 | |
| 1226 | |
| 1227 | static int pthread_spin_init(pthread_spinlock_t *l, int pshared) |
no test coverage detected