Artifact 631c262625a7dafa42f6eef3da1fc88b4d803e162d85488d0e28d99cb3c0eb53:
- File
src/runtime/init.m
— part of check-in
[79011c5f56]
at
2017-06-07 21:38:21
on branch trunk
— runtime: Move all globals into a single struct
This is required to create a .library on MorphOS. (user: js, size: 1388) [annotate] [blame] [check-ins using]
/* * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017 * Jonathan Schleifer <js@heap.zone> * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the * Q Public License 1.0, which can be found in the file LICENSE.QPL included in * the packaging of this file. * * Alternatively, it may be distributed under the terms of the GNU General * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #include "config.h" #import "runtime.h" #import "runtime-private.h" #import "globals.h" struct objc_globals objc_globals = { #ifdef OF_HAVE_THREADS .global_once_control = OF_ONCE_INIT, #endif .lookups_till_fast_path = 128 }; void __objc_exec_class(void *module_) { struct objc_abi_module *module = module_; objc_global_mutex_lock(); objc_register_all_selectors(module->symtab); objc_register_all_classes(module->symtab); objc_register_all_categories(module->symtab); objc_init_static_instances(module->symtab); objc_global_mutex_unlock(); } void objc_exit(void) { objc_global_mutex_lock(); objc_unregister_all_categories(); objc_unregister_all_classes(); objc_unregister_all_selectors(); objc_forget_pending_static_instances(); objc_dtable_cleanup(); objc_global_mutex_unlock(); }