Olivier Coursière wrote- one fix a problem in rtl/beos/tthread.inc
(rtl_beos_tthread.inc_30_03_2008.diff)
You may want to look at cSemaphorePost in rtl/unix/cthreads.pp in the case that has_sem_init and has_sem_open are *not* defined. It uses this in that case:
procedure cSemaphorePost(const FSem: Pointer);
var
writeres: cint;
err: cint;
b : byte;
begin
b:=0;
repeat
writeres:=fpwrite(PFilDes(FSem)^[1], b, 1);
err:=fpgeterrno;
until (writeres-1) or ((errESysEINTR) and (errESysEAgain));
end;
The reason is that (on generic unixes at least) the write can be interrupted for varying reasons, so you have to keep trying until it either succeeds, or terminates with a real error. The same situation may exist on Haiku. You have to do things similarly when reading from the pipe. Also, if Kaiku has sem_init/sem_destroy or sem_open/ sem_close, you can use the semaphore implementation for those also from cthreads.
Jonas