Skip to content

Commit

Permalink
Added __vbReleaseThreadThrowError(), and some GNU fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
icculus committed Oct 2, 2000
1 parent 0254e5f commit 7930800
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
22 changes: 21 additions & 1 deletion BASIClib/Threads.c
Expand Up @@ -19,11 +19,13 @@
#include "Threads.h"

#if (!defined SINGLE_THREADED)
# define __USE_GNU
# include <stdlib.h>
# include <string.h>
# include <pthread.h>
# include <sched.h>
# include <signal.h>
# include <errno.h>
# include "gc.h" /* redefines some pthread stuff; must be last. */

/*
Expand Down Expand Up @@ -380,7 +382,7 @@ void __createThreadLock_f(PThreadLock pThreadLock)
pthread_mutexattr_t attr;

pthread_mutexattr_init(&attr);
attr.mutexkind = PTHREAD_MUTEX_RECURSIVE_NP;
attr.__mutexkind = PTHREAD_MUTEX_RECURSIVE_NP;

if (pthread_mutex_init(pThreadLock, &attr) != 0)
{
Expand Down Expand Up @@ -441,5 +443,23 @@ void __releaseThreadLock_f(PThreadLock pThreadLock)

#endif /* (!defined SINGLE_THREADED) */

void __vbReleaseThreadThrowError(PThreadLock pThreadLock, __long errNum)
/*
* A convenience function. Release (pThreadLock), and throw (errNum).
*
* params : pThreadLock == ThreadLock to release control of.
* errNum == BASIC error to throw (see BasicError.h).
* returns : technically, void, but an error is always thrown.
*/
{

# ifdef SINGLE_THREADED
*pThreadLock = 0; /* reference to prevent compiler bitching. */
# endif

__releaseThreadLock(pThreadLock);
__runtimeError(errNum);
} // __vbReleaseThreadThrowError

/* end of Threads.c ... */

1 change: 1 addition & 0 deletions BASIClib/Threads.h
Expand Up @@ -83,6 +83,7 @@
/* These exist in multi and single thread mode... */
void __initThreads(void);
void __deinitThreads(void);
void __vbReleaseThreadThrowError(PThreadLock pLock, __long errNum);

# ifdef __cplusplus
}
Expand Down

0 comments on commit 7930800

Please sign in to comment.