Overview
| Comment: | Add of_thread_yield() |
|---|---|
| Downloads: | Tarball | ZIP archive | SQL archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA3-256: |
fa79bc173ef8193b3f827c95e2c63fd2 |
| User & Date: | js on 2016-04-18 21:48:08 |
| Other Links: | manifest | tags |
Context
|
2016-04-23
| ||
| 09:43 | Never end enums with a comma (check-in: 3572e824c6 user: js tags: trunk) | |
|
2016-04-18
| ||
| 21:48 | Add of_thread_yield() (check-in: fa79bc173e user: js tags: trunk) | |
| 21:40 | Move of_once() to threading.m (check-in: 3f31bd034d user: js tags: trunk) | |
Changes
Modified src/threading.h from [b27d0410b9] to [adb5774a4e].
| ︙ | |||
169 170 171 172 173 174 175 176 177 178 179 180 181 182 | 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 | + + + + + + + + + + |
return !pthread_key_delete(key);
#elif defined(OF_WINDOWS)
return TlsFree(key);
#else
# error of_tlskey_free not implemented!
#endif
}
static OF_INLINE void
of_thread_yield(void)
{
#if defined(OF_HAVE_SCHED_YIELD)
sched_yield();
#elif defined(OF_WINDOWS)
Sleep(0);
#endif
}
static OF_INLINE bool
of_spinlock_new(of_spinlock_t *spinlock)
{
#if defined(OF_HAVE_ATOMIC_OPS)
*spinlock = 0;
return true;
|
| ︙ | |||
199 200 201 202 203 204 205 | 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 | - - - + - - - - - - |
#endif
}
static OF_INLINE bool
of_spinlock_lock(of_spinlock_t *spinlock)
{
#if defined(OF_HAVE_ATOMIC_OPS)
|
| ︙ |
Modified src/threading.m from [acfd94987f] to [656c95cd33].
| ︙ | |||
29 30 31 32 33 34 35 | 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | - + - - + - - - - - - |
#ifndef OF_HAVE_PTHREADS
void
of_once(of_once_t *control, void (*func)(void))
{
if (of_atomic_int_cmpswap(control, 0, 1)) {
func();
of_atomic_int_inc(control);
|
| ︙ |