Differences From 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]
To Artifact [0fd3a6e663]:
- File src/runtime/threading.m — part of check-in [1cb3d9fef9] at 2012-08-05 10:45:41 on branch trunk — Add of_rmutex_t, a reentrant mutex implementation. (user: js, size: 1335) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
17 18 19 20 21 22 23 24 | #include "config.h" #include <stdio.h> #include <stdlib.h> #import "runtime.h" #import "runtime-private.h" | > | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | | | | | 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | #include "config.h" #include <stdio.h> #include <stdlib.h> #import "runtime.h" #import "runtime-private.h" #import "threading.h" static of_rmutex_t global_mutex; static BOOL global_mutex_init = NO; static void objc_global_mutex_new(void) { if (!of_rmutex_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 (!of_rmutex_lock(&global_mutex)) OBJC_ERROR("Failed to lock global mutex!"); } void objc_global_mutex_unlock(void) { if (!of_rmutex_unlock(&global_mutex)) OBJC_ERROR("Failed to unlock global mutex!"); } void objc_global_mutex_free(void) { if (!of_rmutex_free(&global_mutex)) OBJC_ERROR("Failed to free global mutex!"); } |