1
0
mirror of https://github.com/adtools/clib2.git synced 2025-12-08 14:59:05 +00:00

- The name of the public record locking semaphore has to be preallocated

for OS4 if the AllocSysObject() function is used to create it.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14905 87f5fb63-7c3d-0410-a384-fd976d0f7a62
This commit is contained in:
Olaf Barthel
2005-03-26 10:53:35 +00:00
parent b1ac45a0b9
commit 58d26ce8cb
3 changed files with 24 additions and 11 deletions

View File

@ -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)

View File

@ -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

View File

@ -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