Comments on porting to other systems.

The server needs good POSIX threads or a port of the included MIT
threads package. The only native thread package's we have used is
Solaris 2.5 pthreads and LinuxThreads.

The hard part of porting to a new unix variant is probably to port MIT
threads. Se mit-pthreads/README.

Both the server and the client needs a working C++ compiler (we use
gcc and soon SparcWorks).

To compile only the client use "./configure --without-server"

There is currently no support for only compiling the server. Nor is it
likly to be added unless someone has a good reason for it.

If you want/need to change to Makefiles or configure.in you must get
automake and autoconf. We have used autoconf-2.12 and automake-1.0.

All steps needed to remake everything from the most basic files.

/bin/rm */.deps/*.P
/bin/rm -f config.cache
autoheader
automake -v
autoconf
./configure
# The makefiles generated above needs GNU make (called gmake below)
gmake clean all install init-db

-------------------------------------------------------------

Comments about RTS threads:

I have tried to use the RTS thread packages with MySQL but stumbled on the
following problems:

They use old version of a lot of posix calls and it is very tedious to make
wrappers for all functions. I am inclined to think that it would be easier to
change the thread libraries the newest posix specification.

Some wrappers are already written. Se mysys/my_pthread.c for more info.

At least the following should be changed:

pthread_get_specific should use on argument.
sigwait should take two arguments.
A lot of functions (at least pthread_cond_wait, pthread_cond_timedwait)
should return the error code on error. Now they return -1 and set errno.

Another problem is that user level threads uses the ALRM signal and this
aborts a lot of functions (read, write, open...).  MySQL should do a retry
on interrupt on all of these but it not that easy to verify it.

The biggest unsolved problem is the following:

To get thread_level alarms I changed mysys/thr_alarm.c to wait between alarms
with pthread_cond_timedwait() but this aborts with error EINTR.
I tried to debug the thread library why this happens but couldn't find any
easy solution.

If someone wants to try MySQL with RTS threads I suggest the following:

- Change functions MySQL uses from the thread library to posix.
  This shouldn't take that long.

- Compile all libraries with the -DHAVE_rts_threads.
- Compile thr_alarm
- Run thr_alarm. If it runs without any 'warning', 'error' or aborted messages
  you are one the right track. Here follows an successful run on Solaris:

Main thread: 1
Tread 0 (5) started
Thread: 5  Waiting
process_alarm
Tread 1 (6) started
Thread: 6  Waiting
process_alarm
process_alarm
thread_alarm
Thread: 6  Sleeped for 1 (1) sec
Thread: 6  Waiting
process_alarm
process_alarm
thread_alarm
Thread: 6  Sleeped for 2 (2) sec
Thread: 6  Simulation of no alarm needed
Thread: 6  Sleeped for 0 (3) sec
Thread: 6  Waiting
process_alarm
process_alarm
thread_alarm
Thread: 6  Sleeped for 4 (4) sec
Thread: 6  Waiting
process_alarm
thread_alarm
Thread: 5  Sleeped for 10 (10) sec
Thread: 5  Waiting
process_alarm
process_alarm
thread_alarm
Thread: 6  Sleeped for 5 (5) sec
Thread: 6  Waiting
process_alarm
process_alarm

...
thread_alarm
Thread: 5  Sleeped for 0 (1) sec
end

- If there is some small differences in the implementation they may be fixed
  by changing my_pthread.h and my_pthread.c


When I get some more time over I shall try to do the above if no one has done
it yet.
