Skip to content

Commit

Permalink
Implemented DosCloseMutexSem().
Browse files Browse the repository at this point in the history
This gets PhysicsFS's test_physfs.exe to run (although it's still broken in
other ways).
  • Loading branch information
icculus committed Sep 15, 2017
1 parent 4e64524 commit ceb7900
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
18 changes: 18 additions & 0 deletions native/doscalls.c
Expand Up @@ -258,6 +258,7 @@ LX_NATIVE_MODULE_INIT({ if (!initDoscalls()) return NULL; })
LX_NATIVE_EXPORT(DosWaitEventSem, 329),
LX_NATIVE_EXPORT(DosQueryEventSem, 330),
LX_NATIVE_EXPORT(DosCreateMutexSem, 331),
LX_NATIVE_EXPORT(DosCloseMutexSem, 333),
LX_NATIVE_EXPORT(DosRequestMutexSem, 334),
LX_NATIVE_EXPORT(DosReleaseMutexSem, 335),
LX_NATIVE_EXPORT(DosSubSetMem, 344),
Expand Down Expand Up @@ -2995,5 +2996,22 @@ static APIRET16 bridge16to32_DosSemSet(uint8 *args)
return DosSemSet(sem);
} // bridge16to32_DosSemSet


APIRET DosCloseMutexSem(HMTX hmtx)
{
TRACE_NATIVE("DosCloseMutexSem(%u)", (uint) hmtx);

if (hmtx) {
pthread_mutex_t *mutex = (pthread_mutex_t *) hmtx;
const int rc = pthread_mutex_destroy(mutex);
if (rc == 0)
return NO_ERROR;
else if (rc == EBUSY)
return ERROR_SEM_BUSY;
}

return ERROR_INVALID_HANDLE;
} // DosCloseMutexSem

// end of doscalls.c ...

1 change: 1 addition & 0 deletions native/doscalls.h
Expand Up @@ -446,6 +446,7 @@ APIRET OS2API DosQueryExtLIBPATH(PSZ pszExtLIBPATH, ULONG flags);
APIRET OS2API DosSetMaxFH(ULONG cFH);
APIRET OS2API DosQueryThreadContext(TID tid, ULONG level, PCONTEXTRECORD pcxt);
ULONG OS2API DosSelToFlat(VOID);
APIRET OS2API DosCloseMutexSem(HMTX hmtx);

#ifdef __cplusplus
}
Expand Down

0 comments on commit ceb7900

Please sign in to comment.