1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-10-25 20:58:26 +03:00

Windows implementation of the thread-specific data interface. (CVS 2864)

FossilOrigin-Name: 3aa8befedf4534cd100a7309997a4ad2ba08af20
This commit is contained in:
drh
2006-01-06 00:36:00 +00:00
parent d78901da51
commit 3fbb0b1a3b
4 changed files with 49 additions and 28 deletions

View File

@@ -1663,24 +1663,24 @@ static void *unixThreadSpecificData(int nByte){
sqlite3Os.xLeaveMutex();
}
pTsd = (SqliteTsd *)pthread_getspecific(key);
pTsd = pthread_getspecific(key);
if( !pTsd ){
pTsd = sqlite3Os.xMalloc(sizeof(SqliteTsd));
pTsd = sqlite3Os.xMalloc(nByte);
if( pTsd ){
memset(pTsd, 0, sizeof(SqliteTsd));
memset(pTsd, 0, nByte);
pthread_setspecific(key, pTsd);
}
}
return pTsd;
#else
static char tsd[sizeof(SqliteTsd)];
static int isInit = 0;
assert( nByte==sizeof(SqliteTsd) );
if( !isInit ){
memset(tsd, 0, sizeof(SqliteTsd));
isInit = 1;
static void *pTsd = 0;
if( !pTsd ){
pTsd = sqlite3Os.xMalloc(nByte);
if( pTsd ){
memset(pTsd, 0, nByte);
}
}
return (void *)tsd;
return pTsd;
#endif
}