[fpc-pascal]Java vs. Freepascal

Peter Vreman peter at freepascal.org
Thu Jan 11 14:49:06 CET 2001


> Re!
> OK, I understand (maybe).
> So in java I create a server socket and add  to a thread (the thread handle the client),

> and the main program wait the next socket.
> In Pascal is possible?
> The Java create dinamicaly thread (no controlling or array, only type: 
> new class.threadname(thSocket);
> That's all. I want to this is Pascal, but I don't want to use sscoket library, I want to
create 
> this unit for all platforms where avaible the thread and the socket unit.
> So It's possible?
> Or I wait a later version?

When you want to use threads you should wait until threads are fully supported by FPC.
Until then you can either wait or help implementing the thread support. Compiler support
for threadvars is already available, but the implementation in the RTL is still missing.
What still needs to be done in the current development compiler:

1. Add thread support to the RTL, a basic infrastructure has been created already. For
linux the code could largely be taken from the current TTHread implementation

2. When the thread code is ready in the RTL the heapmanager can be made threadsafe (a
quick hack would be to place a global heap lock) and some variables like exception-stacks
and inoutres should be made a threadvar.

3. Adapt TThread class to use the new RTL functions









More information about the fpc-pascal mailing list