Max 5 API Reference
00001 /* 00002 jit.critical.c 00003 00004 Copyright 2001-2005 - Cycling '74 00005 Joshua Kit Clayton jkc@cycling74.com 00006 00007 */ 00008 #include "jit.common.h" 00009 00010 static long _jit_crit_count=0; 00011 00012 /** 00013 * Enters the global Jitter critical region. 00014 * This function is useful for simple protection of thread sensitive 00015 * operations. However, it may be too broad a lock, as it prevents 00016 * any other operations that use the global critical region from 00017 * working. For more localized control, I would suggest using either 00018 * MaxMSP's systhread API or the platform specific locking mechanisms 00019 * however, be sensitive to the possibility deadlock when locking code 00020 * which calls code which may require the locking off unknown resources. 00021 * 00022 * @ingroup utilitymod 00023 * 00024 */ 00025 void jit_global_critical_enter(void) 00026 { 00027 critical_enter(0); 00028 _jit_crit_count++; 00029 } 00030 00031 /** 00032 * Exits the global Jitter critical region. 00033 * This function is useful for simple protection of thread sensitive 00034 * operations. However, it may be too broad a lock, as it prevents 00035 * any other operations that use the global critical region from 00036 * working. For more localized control, I would suggest using either 00037 * MaxMSP's systhread API or the platform specific locking mechanisms 00038 * however, be sensitive to the possibility deadlock when locking code 00039 * which calls code which may require the locking off unknown resources. 00040 * 00041 * @ingroup utilitymod 00042 * 00043 */ 00044 void jit_global_critical_exit(void) 00045 { 00046 critical_exit(0); 00047 _jit_crit_count--; 00048 }
Copyright © 2008, Cycling '74