Sign in Join

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

Mailing lists / fpc-devel / 2012-04

improving error message when forgot to use cthreads unit

4 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

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

Mattias Gaertner

Hi,

When someone forgets to use the cthreads unit and creates a thread the exception message is:

Semaphore init failed (possibly too many concurrent threads)

Can this message be improved for unix?

Can it check if the thread manager is valid and then emit something like

Semaphore init failed (possibly too many concurrent threads or you forgot to use the cthreads unit in your program)

Of course 'cthreads' is just one possible thread manager, but afaik it is commonly used, so it would give the programmer a hint into the right direction.

Mattias

Reply by email

Michael Van Canneyt
to Mattias Gaertner
Mattias Gaertner wrote 11 lines
Hi, When someone forgets to use the cthreads unit and creates a thread the exception message is: Semaphore init failed (possibly too many concurrent threads) Can this message be improved for unix? Can it check if the thread manager is valid and then emit something like

Define 'valid thread manager' ?

Michael.

Reply by email

Mattias Gaertner
to Michael Van Canneyt
Show quoted text 17 lines
On Sat, 28 Apr 2012, Mattias Gaertner wrote: > Hi, > > When someone forgets to use the cthreads unit and creates a thread the > exception message is: > > Semaphore init failed (possibly too many concurrent threads) > > Can this message be improved for unix? > > Can it check if the thread manager is valid and then emit something > like Define 'valid thread manager' ?

I feared someone would ask that.
Maybe check if it is the default one?

Mattias

Reply by email

Mattias Gaertner
to Mattias Gaertner
Show quoted text 23 lines
On Sat, 28 Apr 2012 10:52:08 +0200 (CEST) Michael Van Canneyt wrote: > > > On Sat, 28 Apr 2012, Mattias Gaertner wrote: > > > Hi, > > > > When someone forgets to use the cthreads unit and creates a thread the > > exception message is: > > > > Semaphore init failed (possibly too many concurrent threads) > > > > Can this message be improved for unix? > > > > Can it check if the thread manager is valid and then emit something > > like > > Define 'valid thread manager' ? I feared someone would ask that. Maybe check if it is the default one?

Maybe something like

{$IFDEF Unix}
GetThreadManager(TM);
if not Assigned(TM.InitManager) then
  ...add a note about cthreads...
{$ENDIF}

Mattias

Reply by email