2 * shared.c: Shared memory handling, and daemon launching
5 * Dick Porter (dick@ximian.com)
7 * (C) 2002-2006 Novell, Inc.
13 #include <mono/io-layer/wapi-private.h>
14 #include <mono/io-layer/shared.h>
15 #include <mono/utils/mono-os-mutex.h>
18 //#define DEBUGLOG(...) g_message(__VA_ARGS__);
20 static mono_mutex_t noshm_sems[_WAPI_SHARED_SEM_COUNT];
23 _wapi_shm_semaphores_init (void)
26 for (i = 0; i < _WAPI_SHARED_SEM_COUNT; i++)
27 mono_os_mutex_init (&noshm_sems [i]);
31 _wapi_shm_sem_lock (int sem)
33 DEBUGLOG ("%s: locking nosem %d", __func__, sem);
34 return mono_os_mutex_lock (&noshm_sems[sem]);
38 _wapi_shm_sem_trylock (int sem)
40 DEBUGLOG ("%s: trying to lock nosem %d", __func__, sem);
41 return mono_os_mutex_trylock (&noshm_sems[sem]);
45 _wapi_shm_sem_unlock (int sem)
47 DEBUGLOG ("%s: unlocking nosem %d", __func__, sem);
48 return mono_os_mutex_unlock (&noshm_sems[sem]);