[fpc-devel] Two small patchs to fix errors when building under BeOS/Haiku
Olivier Coursière
olivier.coursiere at laposte.net
Sat Jan 1 21:03:28 CET 2005
In fact, threading is not yet supposed to work under BeOS. It is just a
quick fix to compile. A native BeOS threading implementation would be
great as it is one key point under BeOS. But i am not yet there. Haiku
has a better posix layer, so cthreads could be an option. But i haven't
tried this yet.
Olivier
Jonas Maebe wrote:
>
> On 30 Mar 2008, at 23:08, 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 ((err<>ESysEINTR) and (err<>ESysEAgain));
> 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_______________________________________________
> fpc-devel maillist - fpc-devel at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-devel
>
More information about the fpc-devel
mailing list