Added warning about potential infinite recursion between setError and grabMutex.

This commit is contained in:
Ryan C. Gordon 2002-04-02 13:41:11 +00:00
parent 21a2eda1b5
commit 0ba6cd5259
2 changed files with 12 additions and 1 deletions

View File

@ -262,6 +262,7 @@ typedef struct __PHYSFS_DIRFUNCTIONS__
#define ERR_TOO_MANY_SYMLINKS "Too many symbolic links" #define ERR_TOO_MANY_SYMLINKS "Too many symbolic links"
#define ERR_COMPRESSION "(De)compression error" #define ERR_COMPRESSION "(De)compression error"
#define ERR_NOT_IMPLEMENTED "Not implemented" #define ERR_NOT_IMPLEMENTED "Not implemented"
#define ERR_OS_ERROR "Operating system reported error"
/* /*
* Call this to set the message returned by PHYSFS_getLastError(). * Call this to set the message returned by PHYSFS_getLastError().
@ -663,6 +664,10 @@ void __PHYSFS_platformDestroyMutex(void *mutex);
* unrecoverable problem grabbing it (this should not be a matter of * unrecoverable problem grabbing it (this should not be a matter of
* timing out! We're talking major system errors; block until the mutex * timing out! We're talking major system errors; block until the mutex
* is available otherwise.) * is available otherwise.)
*
* _DO NOT_ call __PHYSFS_setError() in here! Since setError calls this
* function, you'll cause an infinite recursion. This means you can't
* use the BAIL_*MACRO* macros, either.
*/ */
int __PHYSFS_platformGrabMutex(void *mutex); int __PHYSFS_platformGrabMutex(void *mutex);
@ -671,6 +676,10 @@ int __PHYSFS_platformGrabMutex(void *mutex);
* once for each time that platformGrabMutex was called. Once possession has * once for each time that platformGrabMutex was called. Once possession has
* been released, the next thread in line to grab the mutex (if any) may * been released, the next thread in line to grab the mutex (if any) may
* proceed. * proceed.
*
* _DO NOT_ call __PHYSFS_setError() in here! Since setError calls this
* function, you'll cause an infinite recursion. This means you can't
* use the BAIL_*MACRO* macros, either.
*/ */
void __PHYSFS_platformReleaseMutex(void *mutex); void __PHYSFS_platformReleaseMutex(void *mutex);

View File

@ -207,12 +207,14 @@ void __PHYSFS_platformDestroyMutex(void *mutex)
int __PHYSFS_platformGrabMutex(void *mutex) int __PHYSFS_platformGrabMutex(void *mutex)
{ {
BAIL_MACRO(ERR_NOT_IMPLEMENTED, 0); /* not implemented, but can't call __PHYSFS_setError! */
return(0);
} /* __PHYSFS_platformGrabMutex */ } /* __PHYSFS_platformGrabMutex */
void __PHYSFS_platformReleaseMutex(void *mutex) void __PHYSFS_platformReleaseMutex(void *mutex)
{ {
/* not implemented, but can't call __PHYSFS_setError! */
} /* __PHYSFS_platformReleaseMutex */ } /* __PHYSFS_platformReleaseMutex */
/* end of skeleton.c ... */ /* end of skeleton.c ... */