diff --git a/library/GNUmakefile.os4 b/library/GNUmakefile.os4 index ea5fa9f..97132a3 100644 --- a/library/GNUmakefile.os4 +++ b/library/GNUmakefile.os4 @@ -1,5 +1,5 @@ # -# $Id: GNUmakefile.os4,v 1.47 2005-03-20 17:14:58 obarthel Exp $ +# $Id: GNUmakefile.os4,v 1.48 2005-03-26 10:53:35 obarthel Exp $ # # :ts=8 # @@ -113,7 +113,7 @@ WARNINGS = \ INCLUDES = -Iinclude -I. -I$(SDK_INCLUDE) #OPTIONS = -D__THREAD_SAFE -DNDEBUG -DUSE_64_BIT_INTS -D__USE_INLINE__ -Wa,-mregnames -fno-common OPTIONS = -DNDEBUG -DUSE_64_BIT_INTS -D__USE_INLINE__ -Wa,-mregnames -fno-common -OPTIMIZE = -O3 -fomit-frame-pointer -funroll-loops +OPTIMIZE = -O3 #DEBUG = -ggdb CFLAGS = $(WARNINGS) $(OPTIMIZE) $(DEBUG) $(OPTIONS) $(CODE_TYPE) $(INCLUDES) diff --git a/library/changes b/library/changes index 7493e14..afefcbc 100644 --- a/library/changes +++ b/library/changes @@ -1,3 +1,7 @@ +- The name of the public record locking semaphore has to be preallocated + for OS4 if the AllocSysObject() function is used to create it. + + c.lib 1.190 (25.3.2005) - DoTimer() now calls AllocSysObject() rather than making up diff --git a/library/stdio_record_locking.c b/library/stdio_record_locking.c index bb59416..6156990 100644 --- a/library/stdio_record_locking.c +++ b/library/stdio_record_locking.c @@ -1,5 +1,5 @@ /* - * $Id: stdio_record_locking.c,v 1.7 2005-03-18 12:38:23 obarthel Exp $ + * $Id: stdio_record_locking.c,v 1.8 2005-03-26 10:53:35 obarthel Exp $ * * :ts=4 * @@ -138,17 +138,24 @@ obtain_file_lock_semaphore(BOOL shared) if(FileLockSemaphore == NULL && __file_lock_semaphore_name != NULL && __file_lock_semaphore_name[0] != '\0') { - struct FileLockSemaphore * fls; + struct FileLockSemaphore * fls = NULL; + char * semaphore_name_copy = NULL; /* We allocate the new semaphore first, so that we don't spend any time in Forbid() allocating memory. */ #if defined(__amigaos4__) { - fls = AllocSysObjectTags(ASOT_SEMAPHORE, - ASOSEM_Size, sizeof(*fls), - ASOSEM_Name, __file_lock_semaphore_name, - ASOSEM_Pri, 1, - TAG_END); + semaphore_name_copy = AllocVec(strlen(__file_lock_semaphore_name)+1,MEMF_ANY|MEMF_PUBLIC); + if(semaphore_name_copy != NULL) + { + strcpy(semaphore_name_copy,__file_lock_semaphore_name); + + fls = AllocSysObjectTags(ASOT_SEMAPHORE, + ASOSEM_Size, sizeof(*fls), + ASOSEM_Name, semaphore_name_copy, + ASOSEM_Pri, 1, + TAG_END); + } } #else { @@ -157,8 +164,6 @@ obtain_file_lock_semaphore(BOOL shared) { memset(fls,0,sizeof(*fls)); - InitSemaphore(&fls->fls_Semaphore); - fls->fls_Semaphore.ss_Link.ln_Name = (char *)(fls + 1); strcpy(fls->fls_Semaphore.ss_Link.ln_Name,__file_lock_semaphore_name); @@ -187,6 +192,8 @@ obtain_file_lock_semaphore(BOOL shared) FileLockSemaphore = fls; fls = NULL; + + semaphore_name_copy = NULL; } else { @@ -212,6 +219,8 @@ obtain_file_lock_semaphore(BOOL shared) { #if defined(__amigaos4__) { + FreeVec(semaphore_name_copy); + FreeSysObject(ASOT_SEMAPHORE,fls); } #else