mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-22 18:43:02 +01:00
Some things is moved from R1.5.1.
Starting separating of defines accoding SOLARIS -- any threading modes SOLARIS_MT - solaris with Sun threading model current nothing - solaris with posix threading model
This commit is contained in:
parent
cdbe86c660
commit
af0ab61ae2
@ -1,4 +1,4 @@
|
||||
dnl $Id: configure.in,v 1.210 2004-11-07 13:43:43 alexpeshkoff Exp $
|
||||
dnl $Id: configure.in,v 1.211 2004-12-24 09:35:24 kkuznetsov Exp $
|
||||
|
||||
dnl ############################# INITIALISATION ###############################
|
||||
|
||||
@ -111,6 +111,8 @@ case "$target" in
|
||||
LOCK_MANAGER_FLG=N
|
||||
EDITLINE_FLG=N
|
||||
SHRLIB_EXT=so
|
||||
PTHREAD_CFLAGS=-threads
|
||||
PTHREAD_LIBS=-lthread
|
||||
;;
|
||||
|
||||
sparc-sun-solaris*)
|
||||
|
@ -93,7 +93,7 @@ private:
|
||||
//# define TLS_SET(NAME, VALUE) NAME = (VALUE)
|
||||
#else
|
||||
|
||||
#if not (defined SOLARIS)
|
||||
#if not (defined SOLARIS_MT)
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
@ -123,7 +123,7 @@ public:
|
||||
private:
|
||||
pthread_key_t key;
|
||||
};
|
||||
#else //SOLARIS
|
||||
#else //SOLARIS_MT
|
||||
#include <thread.h>
|
||||
#include <string.h>
|
||||
|
||||
@ -167,7 +167,7 @@ private:
|
||||
};
|
||||
|
||||
|
||||
#endif //SOLARIS
|
||||
#endif //SOLARIS_MT
|
||||
|
||||
} // namespace Firebird
|
||||
|
||||
|
@ -24,7 +24,7 @@
|
||||
* Contributor(s): ______________________________________.
|
||||
*
|
||||
*
|
||||
* $Id: locks.h,v 1.18 2004-11-07 10:52:32 robocop Exp $
|
||||
* $Id: locks.h,v 1.19 2004-12-24 09:35:39 kkuznetsov Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
@ -39,7 +39,7 @@
|
||||
// in thd.h ? This is Windows platform maintainers choice
|
||||
#include <windows.h>
|
||||
#else
|
||||
#ifndef SOLARIS
|
||||
#ifndef SOLARIS_MT
|
||||
#include <pthread.h>
|
||||
#else
|
||||
#include <thread.h>
|
||||
@ -82,7 +82,7 @@ public:
|
||||
|
||||
/* Process-local spinlock. Used to manage memory heaps in threaded environment. */
|
||||
// Pthreads version of the class
|
||||
#if !defined(SOLARIS) && !defined(DARWIN) && !defined(FREEBSD) && !defined(NETBSD)
|
||||
#if !defined(SOLARIS_MT) && !defined(DARWIN) && !defined(FREEBSD) && !defined(NETBSD)
|
||||
class Mutex {
|
||||
private:
|
||||
pthread_spinlock_t spinlock;
|
||||
@ -105,7 +105,7 @@ public:
|
||||
}
|
||||
};
|
||||
#else
|
||||
#ifdef SOLARIS
|
||||
#ifdef SOLARIS_MT
|
||||
// Who knows why Solaris 2.6 have not THIS funny spins?
|
||||
//The next code is not comlpeted but let me compile //Konstantin
|
||||
class Mutex {
|
||||
|
@ -24,7 +24,7 @@
|
||||
* Contributor(s): ______________________________________.
|
||||
*
|
||||
*
|
||||
* $Id: rwlock.h,v 1.23 2004-11-07 10:52:32 robocop Exp $
|
||||
* $Id: rwlock.h,v 1.24 2004-12-24 09:35:39 kkuznetsov Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
@ -155,7 +155,7 @@ public:
|
||||
|
||||
#ifdef MULTI_THREAD
|
||||
|
||||
#ifdef SOLARIS
|
||||
#ifdef SOLARIS_MT
|
||||
|
||||
#include <thread.h>
|
||||
#include <synch.h>
|
||||
@ -306,7 +306,7 @@ public:
|
||||
|
||||
} // namespace Firebird
|
||||
|
||||
#endif /*solaris*/
|
||||
#endif /*solaris threading (not posix)*/
|
||||
|
||||
#else
|
||||
|
||||
|
@ -24,7 +24,7 @@
|
||||
* Contributor(s): ______________________________________.
|
||||
*
|
||||
*
|
||||
* $Id: semaphore.h,v 1.16 2004-11-24 09:05:12 robocop Exp $
|
||||
* $Id: semaphore.h,v 1.17 2004-12-24 09:35:39 kkuznetsov Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
@ -74,7 +74,7 @@ public:
|
||||
|
||||
#ifdef MULTI_THREAD
|
||||
|
||||
#ifdef SOLARIS
|
||||
#ifdef SOLARIS_MT
|
||||
/* This is dummy, untested implementation of FB::Semaphore
|
||||
on Solaris using conditional variable protected by mutex.
|
||||
I'll review it later
|
||||
|
@ -111,7 +111,7 @@ typedef struct sh_mem* SH_MEM;
|
||||
// to avoid circular dependencies in h-files.
|
||||
// Alex Peshkov. Tue 08 Jun 2004 02:22:08 PM MSD.
|
||||
|
||||
#if (defined(SOLARIS) && defined(SOLARIS_MT))
|
||||
#if defined(SOLARIS_MT)
|
||||
#include <thread.h>
|
||||
#define COND_STRUCT cond_t
|
||||
#define MUTEX_STRUCT mutex_t
|
||||
|
@ -49,7 +49,7 @@
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef SOLARIS
|
||||
#ifdef SOLARIS_MT
|
||||
#include <thread.h>
|
||||
#include <signal.h>
|
||||
#endif
|
||||
|
@ -26,7 +26,7 @@
|
||||
*
|
||||
*/
|
||||
/*
|
||||
$Id: thd.h,v 1.39 2004-11-24 09:22:07 robocop Exp $
|
||||
$Id: thd.h,v 1.40 2004-12-24 09:35:42 kkuznetsov Exp $
|
||||
*/
|
||||
|
||||
#ifndef JRD_THD_H
|
||||
@ -108,7 +108,7 @@ const int SWEEP_QUANTUM = 10; /* Make sweeps less disruptive */
|
||||
#define THREAD_ENTRY_PARAM void*
|
||||
#define THREAD_ENTRY_RETURN void*
|
||||
#define THREAD_ENTRY_CALL
|
||||
#elif defined(SOLARIS)
|
||||
#elif defined(SOLARIS_MT)
|
||||
#define THREAD_ENTRY_PARAM void*
|
||||
#define THREAD_ENTRY_RETURN void *
|
||||
#define THREAD_ENTRY_CALL
|
||||
|
@ -21,10 +21,14 @@
|
||||
* Contributor(s): ______________________________________.
|
||||
*/
|
||||
/*
|
||||
$Id: util.cpp,v 1.5 2004-05-09 05:48:33 robocop Exp $
|
||||
$Id: util.cpp,v 1.6 2004-12-24 09:35:45 kkuznetsov Exp $
|
||||
*/
|
||||
|
||||
#include "firebird.h"
|
||||
#ifdef SOLARIS_MT
|
||||
#include <thread.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
@ -96,13 +100,24 @@ pid_t UTIL_start_process(const char* process, char** argv)
|
||||
|
||||
/* add place in argv for visibility to "ps" */
|
||||
strcpy(argv[0], string);
|
||||
#if (defined SOLARIS_MT)
|
||||
if (!(pid = fork1())) {
|
||||
if (execv(string, argv)== -1){
|
||||
ib_fprintf(ib_stderr, "Could not create child process %s with args %s\n",
|
||||
string, argv);
|
||||
|
||||
}
|
||||
exit(FINI_ERROR);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
pid_t pid = vfork();
|
||||
if (!pid) {
|
||||
execv(string, argv);
|
||||
_exit(FINI_ERROR);
|
||||
}
|
||||
|
||||
#endif
|
||||
return (pid);
|
||||
}
|
||||
|
||||
|
@ -23,6 +23,10 @@
|
||||
*/
|
||||
|
||||
#include "firebird.h"
|
||||
#ifdef SOLARIS_MT
|
||||
#include <thread.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@ -489,17 +493,37 @@ static bool start_server( ibmgr_data_t* data)
|
||||
else
|
||||
argv[1] = option_f;
|
||||
argv[2] = NULL;
|
||||
|
||||
argv[3] = NULL;
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("Argument list:\n\"%s\"\n\"%s\"\n", argv[0], argv[1]);
|
||||
#endif
|
||||
|
||||
pid_t pid;
|
||||
#if (defined SOLARIS_MT)
|
||||
/* Accoding Sun's documentation vfork() is not MT-safe
|
||||
while linking with libthreads, fork1 - fork one thread
|
||||
*/
|
||||
if (!(pid = fork1())) {
|
||||
if (execv(path, argv)== -1){
|
||||
ib_fprintf(OUTFILE, "Could not create child process %s with args %s\n",
|
||||
path, argv);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
_exit(FINI_ERROR);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
if (!(pid = vfork())) {
|
||||
execv(path, argv);
|
||||
_exit(FINI_ERROR);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Wait a little bit to let the server start
|
||||
*/
|
||||
@ -524,12 +548,28 @@ static bool start_server( ibmgr_data_t* data)
|
||||
0 if an exit status of a child process is unavailable (that
|
||||
means in our case that the server is running).
|
||||
*/
|
||||
#if (defined SOLARIS_MT)
|
||||
/* Trying to understand why it dead */
|
||||
if ((ret_value == pid)&&( WIFEXITED(exit_status)
|
||||
||WCOREDUMP(exit_status)
|
||||
||WIFSIGNALED(exit_status))) {
|
||||
ib_printf("Guardian process %ld terminated with code %ld\n",
|
||||
pid,WEXITSTATUS(exit_status));
|
||||
break;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
|
||||
if (ret_value == pid) {
|
||||
#ifdef DEBUG
|
||||
printf("Guardian process %ld terminated\n", pid);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
#endif /*SOLARIS_MT*/
|
||||
|
||||
#ifdef DEBUG
|
||||
else if (ret_value == -1) {
|
||||
printf("waitpid returned error, errno = %ld\n", errno);
|
||||
|
Loading…
Reference in New Issue
Block a user