Differences From Artifact [9475bcca1a]:
- File
src/once.m
— part of check-in
[5358e9ea6a]
at
2019-08-01 20:14:35
on branch trunk
— Split threading.[hm] into multiple files
This allows the runtime to only link against the parts it needs, without
pulling in unnecessary parts like thread spawning, TLS and conditions. (user: js, size: 1196) [annotate] [blame] [check-ins using]
To Artifact [4811cc42bf]:
- File src/once.m — part of check-in [c2bde5d283] at 2019-08-01 21:20:03 on branch trunk — Add of_once() for AmigaOS (user: js, size: 1376) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
14 15 16 17 18 19 20 21 22 23 24 25 26 27 | * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #include "config.h" #import "once.h" #if defined(OF_HAVE_THREADS) && defined(OF_HAVE_ATOMIC_OPS) # import "atomic.h" # import "mutex.h" #endif void | > > > > | 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #include "config.h" #import "once.h" #ifdef OF_AMIGAOS # include <proto/exec.h> #endif #if defined(OF_HAVE_THREADS) && defined(OF_HAVE_ATOMIC_OPS) # import "atomic.h" # import "mutex.h" #endif void |
︙ | ︙ | |||
40 41 42 43 44 45 46 47 48 49 50 | of_memory_barrier(); of_atomic_int_inc(control); } else while (*control == 1) of_thread_yield(); #else # error No of_once available #endif } | > > > > > > > > > > | 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | of_memory_barrier(); of_atomic_int_inc(control); } else while (*control == 1) of_thread_yield(); #elif defined(OF_AMIGAOS) Forbid(); @try { if (*control == 0) { *control = 1; func(); } } @finally { Permit(); } #else # error No of_once available #endif } |