Threads in [Free]Pascal 
Author Message
 Threads in [Free]Pascal

Hi, All!

When I studied programming in C and Java I learned about threads. Now I
would like to know, if it is possible to program in my favourite
programming language (Pascal) using threads? If it is possible, a simple
example (using semaphores) would be nice...

It is hard to search it from the web, because all I can find is mailing
list "threads"... I found a couple of places in freepascal documentation
where threads are mentioned, but no sophisticated example. From Freepascal
homepage under units I found pthreads, but it is only a wrapper and only
for Linux... is it any good?

Not that I am going to write any big and CPU-intensive programs. I am just
interested because I have dual-CPU computer. Also, because all new P4-s
come with Hyperthreading, this should be a hot topic...

Imot Algma



Fri, 05 Aug 2005 16:02:21 GMT  
 Threads in [Free]Pascal

Quote:

> When I studied programming in C and Java I learned about threads. Now I
> would like to know, if it is possible to program in my favourite
> programming language (Pascal) using threads? If it is possible, a simple
> example (using semaphores) would be nice...

> It is hard to search it from the web, because all I can find is mailing
> list "threads"... I found a couple of places in freepascal documentation
> where threads are mentioned, but no sophisticated example. From Freepascal
> homepage under units I found pthreads, but it is only a wrapper and only
> for Linux... is it any good?

There are currently two ways of threading in FPC.
- The old way, using Linux.clone, or the FCL TThread classes. (not used
  much, a lot of gotcha's, basically do it your self.)
- The newer pthreads based that works on a language level (including
  threadvar, more threadsafe RTL e.d.) This is available only in the
  development version, since it requires RTL and compiler support (1.1.x).
  See unit systhrds. This development version is usable though.
  (in the tests/ dir there is a tmt1 program that demonstrates threads a bit)
 ( for an idea see http://www.freepascal.org/cgi-bin/viewcvs.cgi/fpc/rtl/unix/systhrds.pp)

Quote:
> Not that I am going to write any big and CPU-intensive programs. I am just
> interested because I have dual-CPU computer. Also, because all new P4-s
> come with Hyperthreading, this should be a hot topic...

SMP proof multithreading is already a step further:-)


Fri, 05 Aug 2005 17:16:35 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. threads in free pascal

2. threads in free pascal

3. Threads and pascal

4. free pascal vs turbo pascal - range checking

5. free pascal vs turbo pascal - range checking

6. Annoucement: Free Pascal (aka FPK Pascal) 0.99.5

7. Annoucement: Free Pascal (aka FPK Pascal) 0.99.5

8. Announce: Free Pascal (FPK Pascal) 0.99.0

9. Announce: Free Pascal (FPK Pascal) 0.99.0

10. Free, free programmer!!!

11. Free Delphi Resource, 1,000+ Delphi Apps for Free

12. Problem with Free Pascal/Windows 2000 Pro

 

 
Powered by phpBB® Forum Software