Non pre-emptive POSIX threads for m68k Amiga ported,
this consists of 2 gcc linker libraries libpthread.a and libpth.a.
On this webpage and its linked webpages I have created 3 of
my own examples of the libpthread part of Pth. These examples
have replaced the supplied examples because I understand them
but dont fully understand the supplied examples. The problem
with the supplied examples is I cannot tell whether or not
they are malfunctioning.
To try out some examples of threaded programs using libpthread.a on 68k Amiga,
visit the following pages:
Binaries have been supplied, you can run all 3 examples from
AmigaOS shells provided you dont type control-C or control-D.
For proper usage you should run them from a
GEEK shell
(currently these examples need ixemul.library):
This is a port of Ralf S Engelschall's
non pre-emptive POSIX threads pth-2.0.0 In particular it includes
his implementation of libpthread.a which is required for
db3 which is required for rpm4.
So a full port of rpm4.0 should now be possible, though
I will be working on other problems first as I think a
full version of rpm4.0 is a non urgent thing.
Pth-2.0.0 is a beta, libpthread appears to be functioning
correctly, but may need some further changes.
This port is 2 link time libraries for gcc,
libpthread.a and libpth.a, ie it is not a user level thing,
nor is it OS level but is linker level.
This is possibly digressing a bit, but I have decided to
upload material about AmigaOS Semaphores. Almost a year ago
I put a webpage about the assign count problem,
but have continuously been too disorganised to upload the
technique to do it properly. ok, I am addressing this problem now,
better late than never!
I give a shell program that brings Semaphores to shell scripts,
this is really useful eg it enables you to queue up shell scripts.
You can run this example and the
other two examples
from an AmigaOS shell provided you dont
type control-C or control-D. For Control-C etc you will need to
run them from
a Geek shell
In all the examples threads write directly to the shell,
no use is made of writer threads.
My own 3 examples have now replaced the supplied examples
as I dont understand the supplied ones.
======== Sunday 22nd February 2004 ============
Activity has slowed down a bit as I am trying to do too many
parallel projects, further things will happen on this topic or "thread"!
I think I may wait till I have an A1 before making use of
libpthread in ports. I will continue with Non-port libpthread things
in the meantime. I currently wont buy an A1 until Hyperion make
available
this stuff
gcc is a much slower compiler than SAS Lattice C, as a result
port work is very time consuming, development via SAS C 650 is much
faster as a result.
I have written an example threaded program showing
threaded graphics. Click to download it.
This example shows both traditional AmigaOS programming
(intuition.library and graphics.library) and Unixy C programming
and threads. Thus pthread provides a threading engine accesible to
traditional AmigaOS, the only catch currently is that you need to
launch the program from a Geek shell.
Its best to run it from a Geek shell,
however I think you can run it from an AmigaOS shell provided you
dont type control-C or D which can cause a crash. The example creates
many threads, each thread opens a small window and repeatedly fills the
window with different colours. All the windows appear to be rendered
simultaneously, yet its non-pre-emptive threads. You can close off
the windows one by one at any time. As its non pre-emptive I havent
bothered with mutual exclusion, (mutual exlusion is automatic for
non pre-emptive threads).
In writing this example I have located further problems,
not sure if the problems are in Pth-2.0.0 or in ixemul. Anyway said
problems have been carefully avoided in the example.
If you want to experiment with these pthreads then act carefully
as certain things can malfunction, the innermost engine at least seems
to be correctly functioning and usable.
================== Tuesday 10th February 2004 ===================
9pm: I am uploading Pth-2.0.0 as a beta, libpthread appears to
be functioning correctly for a simple usage of libpthread program.
For a simple usage of libpthread, explaining how to compile it,
CLICK HERE!
5:30pm Progress at last! I have blown several days unable to fix the
problems I observed. At last I think Pth-2.0.0 is now in a usable form.
I have tried to contact the Pth people by 2 different methods, but total silence.
I think test_select is pathological, it would take too much time to
try and decipher it, so instead I am focussing on making sure progs
I write myself function.
I tried an example program from Chris Provenzano's implementation
and found I have to make some slight changes to Pth-2.0.0's libpthread
before CP's example happened correctly: one function of the API was
missing (pthread_init()) and pthread_exit(0) was causing a recoverable
alert if called by the program. These 2 problems are now fixed.
I have written a very simple example pthread program and at
last this is running correctly with 68020 libpthread via Pth-2.0.0
I will generate now a 68000 default version of the linker libraries,
this will take 1.5 hours to create. :you will then be able to type
-lpth or -lpthread when linking. With the example the program
chooses when thread rescheduling happens via pthread_yield_np().
Without this call a thread would go from start to finish without
interruption (I think). I think this means you dont need mutexes
but only if you use a non-pre-emptive implementation.
================== Sunday 8th February 2004 ===================
As this is Unix coding I was trying everything out on the Geek
shell, the idea of Geek shell + ixemul.library is to emulate the Unix
environment. So I never tried it on the Amiga shell, I have now,
there is malfunction via the Amiga shell eg the keyboard is frozen out
of the shell for test_misc.
Therefore, you need at least a Geek Bourne shell. (pdksh is
a better shell but requires more explanation to set it up).
To set up a minimal Geek environment with Bourne shell,
READ THIS! (updated 10feb2003)
Thus all the threaded example programs should be run
from eg a Bourne or pdksh $ shell prompt.
================
I have made no further progress on the problems with pth-2.0.0,
I made endless attempts to get around the problem.
I have emailed Ralf Engelschall about the problems, but have been told
he takes maybe 25 days to reply to emails,
==========================================================
hnl_dk noticed that pth-amiga-fixes.lha doesnt decompress properly,
so this has been fixed.
I found many of the problems configuring are due to using the
original Geek shell from Boot.lha, /bin/sh. Replacing this with
pdksh from Geek snapshots configuring is now happening correctly.
However the pth configure has semantic bugs, eg it concludes that
SYS_read is not defined by gg:include/sys/syscall.h, when in fact
SYS_read *is* defined there.
:this bug is because SYS_read is defined by an enum and not a "#define".
I have now attempted to port pth-2.0.0 via pdksh, well it was a
straight port, except I got freeze ups and other problems
when I tried the supplied examples. So I fixed the SYS_read
problem above, this time everything went smoothly till I tried test_sig, crash.
Rebooting, I tried the examples again, this time I couldnt quit the shell.
Anyway I will try and reinstate some further things where I know
the configure differs from my pth-1.4.0 configure. If I reinstate everything
from my pth-1.4.0 configure then it may function correctly.
I will try to only upload pth-2.0.0 when I have it functioning
reasonably,
When time permits I will upload some info on writing threaded progs
via pth and pthreads. Just the basic first steps.
Get a GoStats hit counter