Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2011-11

Class TThread in linux;

11 messages · 6 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Everton Vieira

In the creation of a TThread in Linux, openSuse recently installed, causes an exception and close the application.

Even without the debug same resul t.By what I've read on wiki about it, the error should appear only under debug.

Anyone knows something about it?

Everton Vieira. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20111124/9c00bbb0/attachment.html>

Reply by email

silvioprog
to Everton Vieira

2011/11/24 Everton Vieira :

Show quoted text 10 lines
In the creation of a TThread in Linux, openSuse recently installed, causes an exception and close the application. Even without the debug same resul t.By what I've read on wiki about it, the error should appear only under debug. Anyone knows something about it? -- Everton Vieira.

Use:

{$DEFINE UseCThreads}

E.g:

program project1;
{$mode objfpc}{$H+}
{$DEFINE UseCThreads}

uses

  {$IFDEF UNIX}{$IFDEF UseCThreads}
  cthreads,
  {$ENDIF}{$ENDIF}
  Interfaces, ....
Silvio Cl?cio =============================================== Blog - <silvioprog.com.br> Twitter - <twitter.com/silvioprog> Facebook - <facebook.com/silvioprog> LazSolutions - <code.google.com/p/lazsolutions> Lazarus-BR - <groups.google.com.br/group/lazarus-br?hl=pt-BR> =============================================== ? ?* Conhe?a nosso canal IRC sobre Lazarus: #lazarus-br * ===============================================

Reply by email

Everton Vieira
to silvioprog

I'll use it tomorow, just this and will work?

Thanks
Everton

2011/11/24 silvioprog

Show quoted text 49 lines
2011/11/24 Everton Vieira : > In the creation of a TThread in Linux, openSuse recently installed, causes > an exception and close the application. > > Even without the debug same resul t.By what I've read on wiki about it, the > error should appear only under debug. > > Anyone knows something about it? > > -- > Everton Vieira. Use: {$DEFINE UseCThreads} E.g: program project1; {$mode objfpc}{$H+} {$DEFINE UseCThreads} uses {$IFDEF UNIX}{$IFDEF UseCThreads} cthreads, {$ENDIF}{$ENDIF} Interfaces, .... -- Silvio Cl?cio =============================================== Blog - <silvioprog.com.br> Twitter - <twitter.com/silvioprog> Facebook - <facebook.com/silvioprog> LazSolutions - <code.google.com/p/lazsolutions> Lazarus-BR - <groups.google.com.br/group/lazarus-br?hl=pt-BR> =============================================== * Conhe?a nosso canal IRC sobre Lazarus: #lazarus-br * =============================================== -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Everton Vieira. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20111124/2f70b4c2/attachment-0001.html>

Reply by email

silvioprog
to Everton Vieira

2011/11/24 Everton Vieira :

I'll use it tomorow, just this and will work? Thanks Everton

In my projects, it has worked very well. :)

Silvio Cl?cio =============================================== Blog - <silvioprog.com.br> Twitter - <twitter.com/silvioprog> Facebook - <facebook.com/silvioprog> LazSolutions - <code.google.com/p/lazsolutions> Lazarus-BR - <groups.google.com.br/group/lazarus-br?hl=pt-BR> =============================================== ? ?* Conhe?a nosso canal IRC sobre Lazarus: #lazarus-br * ===============================================

Reply by email

William Oliveira Ferreira
to silvioprog

Why should set $define usecthreads? only $ifdef linux doesn?t solve the issue?
________________________________
William de Oliveira Ferreira
Bacharel em Sistemas de Informa??o

2011/11/24 silvioprog

Show quoted text 25 lines
2011/11/24 Everton Vieira : > I'll use it tomorow, just this and will work? > > Thanks > Everton In my projects, it has worked very well. :) -- Silvio Cl?cio =============================================== Blog - <silvioprog.com.br> Twitter - <twitter.com/silvioprog> Facebook - <facebook.com/silvioprog> LazSolutions - <code.google.com/p/lazsolutions> Lazarus-BR - <groups.google.com.br/group/lazarus-br?hl=pt-BR> =============================================== * Conhe?a nosso canal IRC sobre Lazarus: #lazarus-br * =============================================== -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20111125/e4972e0b/attachment.html>

Reply by email

Sven Barth
to William Oliveira Ferreira
William Oliveira Ferreira wrote
Why should set $define usecthreads? only $ifdef linux doesn?t solve the issue?

The default projects of Lazarus contain the following code:

uses

   {$ifdef unix}{$ifdef usecthreads}
   cthreads,
   {$endif}{$endif}
   ...

The "cthreads" unit is the one that must be included for threading support on Unix systems. Using a linux system merely satisfies the "ifdef unix" condition, but you need to define "usecthreads" as well or remove the check completely (you should leave the check for Unix though as the "cthreads" unit is not available for e.g. Windows).

Regards,
Sven

Reply by email

William Oliveira Ferreira
to Sven Barth

Thanks for the awnser, Sven, but, my question is why not only use {$ifdef unix}
cthreads
{$endif}
and i didn?t understand yet...

________________________________
William de Oliveira Ferreira
Bacharel em Sistemas de Informa??o

2011/11/25 Sven Barth

Show quoted text 31 lines
Am 25.11.2011 11:17, schrieb William Oliveira Ferreira: Why should set $define usecthreads? only $ifdef linux doesn?t solve the > issue? > The default projects of Lazarus contain the following code: uses {$ifdef unix}{$ifdef usecthreads} cthreads, {$endif}{$endif} ... The "cthreads" unit is the one that must be included for threading support on Unix systems. Using a linux system merely satisfies the "ifdef unix" condition, but you need to define "usecthreads" as well or remove the check completely (you should leave the check for Unix though as the "cthreads" unit is not available for e.g. Windows). Regards, Sven -- ______________________________**_________________ Lazarus mailing list .**freepascal.org http://lists.lazarus.**freepascal.org/mailman/**listinfo/lazarus<http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20111125/70224ccf/attachment.html>

Reply by email

Sven Barth
to William Oliveira Ferreira
William Oliveira Ferreira wrote 5 lines
Thanks for the awnser, Sven, but, my question is why not only use {$ifdef unix} cthreads {$endif} and i didn?t understand yet...

Using unit "cthreads" also means linking to the C library. As not every applications needs threading (and thus the linking to the C library) this was made optional. If you use Lazarus with a GTK2 or Qt based LCL then you might as well remove the "ifdef usecthreads" as the two mentioned widgetsets include references to the C library, so it doesn't matter whether you use "cthreads" or not. On the other hand if you'd use fpGUI (or fpGUI-LCL) then you might wish to not include "cthreads" as there no linking to the C library is necessary.

I hope it is more clear now.

Regards,
Sven

Reply by email

Mattias Gaertner
to William Oliveira Ferreira: Thanks for the awnser, Sven, but, my question is why not only use {$ifdef unix} cthreads…
Show quoted text 5 lines
Thanks for the awnser, Sven, but, my question is why not only use {$ifdef unix} cthreads {$endif} and i didn?t understand yet...

If you want to use threads in your program, then the above is the correct way.

The cthreads define is only for packages. When your project uses a package, that uses multiple threads, it enables multithreading for the project by defining -dcthreads.

Mattias

Reply by email

William Oliveira Ferreira
to Sven Barth: Using unit "cthreads" also means linking to the C library. As not every applications…

Thanks, now became more clear
________________________________
William de Oliveira Ferreira
Bacharel em Sistemas de Informa??o

2011/11/25 Sven Barth

Show quoted text 30 lines
Am 25.11.2011 15:21, schrieb William Oliveira Ferreira: Thanks for the awnser, Sven, but, my question is why not only use > {$ifdef unix} > cthreads > {$endif} > and i didn?t understand yet... > Using unit "cthreads" also means linking to the C library. As not every applications needs threading (and thus the linking to the C library) this was made optional. If you use Lazarus with a GTK2 or Qt based LCL then you might as well remove the "ifdef usecthreads" as the two mentioned widgetsets include references to the C library, so it doesn't matter whether you use "cthreads" or not. On the other hand if you'd use fpGUI (or fpGUI-LCL) then you might wish to not include "cthreads" as there no linking to the C library is necessary. I hope it is more clear now. Regards, Sven -- ______________________________**_________________ Lazarus mailing list .**freepascal.org http://lists.lazarus.**freepascal.org/mailman/**listinfo/lazarus<http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20111125/6f238961/attachment.html>

Reply by email