2001-05-23 15:26:42 +02:00
|
|
|
/*
|
|
|
|
* PROGRAM: JRD access method
|
|
|
|
* MODULE: thd.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-29 03:45:09 +01:00
|
|
|
*
|
|
|
|
* 2002.10.28 Sean Leyne - Completed removal of obsolete "DGUX" port
|
|
|
|
*
|
2002-10-30 07:40:58 +01:00
|
|
|
* 2002.10.29 Sean Leyne - Removed obsolete "Netware" port
|
|
|
|
*
|
2008-01-16 11:25:04 +01:00
|
|
|
* Alex Peshkov
|
2001-05-23 15:26:42 +02:00
|
|
|
*/
|
|
|
|
|
2003-10-03 03:53:34 +02:00
|
|
|
#ifndef JRD_THD_H
|
|
|
|
#define JRD_THD_H
|
2001-05-23 15:26:42 +02:00
|
|
|
|
2004-06-08 15:41:08 +02:00
|
|
|
#include "firebird.h"
|
2001-05-23 15:26:42 +02:00
|
|
|
#include "../jrd/isc.h"
|
2004-06-08 15:41:08 +02:00
|
|
|
#include "../common/classes/locks.h"
|
|
|
|
#include "../common/classes/rwlock.h"
|
2001-05-23 15:26:42 +02:00
|
|
|
|
2004-06-08 15:41:08 +02:00
|
|
|
// thread run-ability control
|
|
|
|
void THD_sleep(ULONG);
|
2008-01-16 11:25:04 +01:00
|
|
|
void THD_yield();
|
2001-05-23 15:26:42 +02:00
|
|
|
|
2008-01-16 11:25:04 +01:00
|
|
|
// thread ID
|
|
|
|
FB_THREAD_ID getThreadId();
|
2001-05-23 15:26:42 +02:00
|
|
|
|
|
|
|
|
|
|
|
/* Thread quanta */
|
|
|
|
|
2004-05-03 23:43:56 +02:00
|
|
|
const int QUANTUM = 100; /* Default quantum */
|
|
|
|
const int SWEEP_QUANTUM = 10; /* Make sweeps less disruptive */
|
2001-05-23 15:26:42 +02:00
|
|
|
|
|
|
|
|
|
|
|
/* Recursive mutex structure */
|
2004-05-24 19:31:47 +02:00
|
|
|
struct rec_mutx_t {
|
2007-06-06 14:37:24 +02:00
|
|
|
Firebird::Mutex rec_mutx_mtx;
|
2004-04-20 07:57:31 +02:00
|
|
|
FB_THREAD_ID rec_mutx_id;
|
2001-05-23 15:26:42 +02:00
|
|
|
SLONG rec_mutx_count;
|
2008-01-16 11:25:04 +01:00
|
|
|
|
|
|
|
rec_mutx_t()
|
|
|
|
: rec_mutx_id(0), rec_mutx_count(0)
|
|
|
|
{}
|
2004-05-24 19:31:47 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
typedef rec_mutx_t REC_MUTX_T;
|
2001-05-23 15:26:42 +02:00
|
|
|
|
2008-01-16 11:25:04 +01:00
|
|
|
int THD_rec_mutex_lock(struct rec_mutx_t*);
|
|
|
|
int THD_rec_mutex_unlock(struct rec_mutx_t*);
|
2004-06-08 15:41:08 +02:00
|
|
|
|
2008-01-16 11:25:04 +01:00
|
|
|
#endif // JRD_THD_H
|