pike.git / src / threads.c

version» Context lines:

pike.git/src/threads.c:1:   /*   || This file is part of Pike. For copyright information see COPYRIGHT.   || Pike is distributed under GPL, LGPL and MPL. See the file COPYING   || for more information. - || $Id: threads.c,v 1.189 2002/10/28 21:48:09 mast Exp $ + || $Id: threads.c,v 1.190 2002/10/28 21:53:45 mast Exp $   */      #include "global.h" - RCSID("$Id: threads.c,v 1.189 2002/10/28 21:48:09 mast Exp $"); + RCSID("$Id: threads.c,v 1.190 2002/10/28 21:53:45 mast Exp $");      PMOD_EXPORT int num_threads = 1;   PMOD_EXPORT int threads_disabled = 0;      #ifdef _REENTRANT   #include "threads.h"   #include "array.h"   #include "mapping.h"   #include "object.h"   #include "pike_macros.h"
pike.git/src/threads.c:959:    *! In POSIX threads, mutex locks can only be unlocked by the same thread    *! that locked them. In Pike any thread can unlock a locked mutex.    */      /*! @decl MutexKey lock()    *! @decl MutexKey lock(int type)    *!    *! This function attempts to lock the mutex. If the mutex is already    *! locked by a different thread the current thread will sleep until the    *! mutex is unlocked. The value returned is the 'key' to the lock. When -  *! the key is destructed or has no more references the lock will -  *! automatically be unlocked. The key will also be destructed if the lock +  *! the key is destructed or has no more references the mutex will +  *! automatically be unlocked. The key will also be destructed if the mutex    *! is destructed.    *!    *! The @[type] argument specifies what @[lock()] should do if the    *! mutex is already locked by this thread:    *! @int    *! @value 0    *! Throw an error.    *! @value 1    *! Sleep until the mutex is unlocked. Useful if some    *! other thread will unlock it.