1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-12 13:01:09 +03:00

Test the result of pthread_create() and do not call pthread_join() if the

thread creation failed.  Ticket #3933. (CVS 6839)

FossilOrigin-Name: 304c5110ad958b2cc1ddff30e68c8791109128b5
This commit is contained in:
drh
2009-07-03 12:57:58 +00:00
parent 34acdc9573
commit 06150f95e8
3 changed files with 13 additions and 12 deletions

View File

@@ -43,7 +43,7 @@
** * Definitions of sqlite3_vfs objects for all locking methods
** plus implementations of sqlite3_os_init() and sqlite3_os_end().
**
** $Id: os_unix.c,v 1.253 2009/06/17 13:09:39 drh Exp $
** $Id: os_unix.c,v 1.254 2009/07/03 12:57:58 drh Exp $
*/
#include "sqliteInt.h"
#if SQLITE_OS_UNIX /* This file is used on unix only */
@@ -839,13 +839,14 @@ static void testThreadLockingBehavior(int fd_orig){
d.fd = fd;
d.lock = l;
d.lock.l_type = F_WRLCK;
pthread_create(&t, 0, threadLockingTest, &d);
pthread_join(t, 0);
if( pthread_create(&t, 0, threadLockingTest, &d)==0 ){
pthread_join(t, 0);
}
close(fd);
if( d.result!=0 ) return;
threadsOverrideEachOthersLocks = (d.lock.l_type==F_UNLCK);
}
#endif /* SQLITE_THERADSAFE && defined(__linux__) */
#endif /* SQLITE_THREADSAFE && defined(__linux__) */
/*
** Release a unixLockInfo structure previously allocated by findLockInfo().