8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-31 13:23:02 +01:00
firebird-mirror/src/jrd/ThreadData.h

95 lines
2.6 KiB
C
Raw Normal View History

2008-01-16 11:17:51 +01:00
/*
* PROGRAM: JRD access method
* MODULE: ThreadData.h
* DESCRIPTION: Thread support definitions
*
* The contents of this file are subject to the Interbase Public
* License Version 1.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy
* of the License at http://www.Inprise.com/IPL.html
*
* Software distributed under the License is distributed on an
* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express
* or implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code was created by Inprise Corporation
* and its predecessors. Portions created by Inprise Corporation are
* Copyright (C) Inprise Corporation.
*
* All Rights Reserved.
* Contributor(s): ______________________________________.
*
* 2002.10.28 Sean Leyne - Completed removal of obsolete "DGUX" port
*
* 2002.10.29 Sean Leyne - Removed obsolete "Netware" port
*
* Alex Peshkov
*/
#ifndef JRD_THREADDATA_H
#define JRD_THREADDATA_H
#include "firebird.h"
#include "../common/classes/locks.h"
#include "../common/classes/rwlock.h"
#include "../common/classes/alloc.h"
2009-08-16 07:20:17 +02:00
// Thread specific data
2008-01-16 11:17:51 +01:00
class ThreadData
{
public:
enum ThreadDataType {
tddGBL = 1, // used by backup/restore
2009-08-16 07:20:17 +02:00
//tddSQL = 2, // used by DSQL, obsolete
2008-01-16 11:17:51 +01:00
tddDBB = 3, // used in engine
2009-08-16 07:20:17 +02:00
//tddRDB = 4, // used in remote interface, obsolete
tddDBA = 5, // used in gstat utility
//tddIDB = 6, // used by interprocess server, obsolete
2008-01-16 11:17:51 +01:00
tddALICE = 7, // used by gfix
tddSEC = 8 // used by gsec
};
private:
ThreadData* threadDataPriorContext;
ThreadDataType threadDataType; // what kind of thread context this is
public:
explicit ThreadData(ThreadDataType t)
2009-04-04 18:39:31 +02:00
: threadDataPriorContext(0), threadDataType(t)
2008-12-25 07:09:37 +01:00
{}
2008-01-16 11:17:51 +01:00
ThreadDataType getType() const
{
return threadDataType;
}
2008-12-25 07:09:37 +01:00
static ThreadData* getSpecific();
2008-01-16 11:17:51 +01:00
void putSpecific();
2008-12-25 07:09:37 +01:00
static void restoreSpecific();
2008-01-16 11:17:51 +01:00
};
// Thread entry point definitions might much better look in ThreadStart.h,
2008-12-05 01:56:15 +01:00
// but due to need to have them in utilities declarations, and no need in
2008-01-16 11:17:51 +01:00
// gds__thread_start() there, placed here. AP 2007.
#if defined(WIN_NT)
#define THREAD_ENTRY_PARAM void*
#define THREAD_ENTRY_RETURN unsigned int
#define THREAD_ENTRY_CALL __stdcall
#elif defined(USE_POSIX_THREADS)
#define THREAD_ENTRY_PARAM void*
#define THREAD_ENTRY_RETURN void*
#define THREAD_ENTRY_CALL
#else
// Define correct types for other platforms
#define THREAD_ENTRY_PARAM void*
#define THREAD_ENTRY_RETURN int
#define THREAD_ENTRY_CALL
#endif
#define THREAD_ENTRY_DECLARE THREAD_ENTRY_RETURN THREAD_ENTRY_CALL
#endif // JRD_THREADDATA_H