Differences From Artifact [92014702e9]:
- File
src/runtime/threading.m
— part of check-in
[51b73c821c]
at
2012-04-22 16:05:21
on branch runtime
— Safer way to create the global mutex.
__attribute__((constructor)) might not have been called when the runtime
is first used. However, the first usage of the runtime is always
single-threaded, so it is safe to do it this way. (user: js, size: 1906) [annotate] [blame] [check-ins using] [more...]
To Artifact [1343be0c29]:
- File
src/runtime/threading.m
— part of check-in
[345eb93240]
at
2012-07-17 01:09:50
on branch trunk
— Rename ERROR() to OBJC_ERROR().
ERROR seems to be defined on MinGW32 and it's likely that it's also used
on other systems, thus it's better to prefix it with OBJC_. (user: js, size: 1926) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
68 69 70 71 72 73 74 | return of_mutex_free(&mutex->mutex); } static void objc_global_mutex_new(void) { if (!objc_mutex_new(&global_mutex)) | | | | | | 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 | return of_mutex_free(&mutex->mutex); } static void objc_global_mutex_new(void) { if (!objc_mutex_new(&global_mutex)) OBJC_ERROR("Failed to create global mutex!"); global_mutex_init = YES; } void objc_global_mutex_lock(void) { if (!global_mutex_init) objc_global_mutex_new(); if (!objc_mutex_lock(&global_mutex)) OBJC_ERROR("Failed to lock global mutex!"); } void objc_global_mutex_unlock(void) { if (!objc_mutex_unlock(&global_mutex)) OBJC_ERROR("Failed to unlock global mutex!"); } void objc_global_mutex_free(void) { if (!objc_mutex_free(&global_mutex)) OBJC_ERROR("Failed to free global mutex!"); } |