[fpc-pascal] Where is IsMultiThreaded set under Linux?

Graeme Geldenhuys graemeg.lists at gmail.com
Fri Oct 8 13:33:31 CEST 2010


Hi,

Is it the line with InterlockedExchange() call?  The reason I ask, I'm
using FPC 2.4.3 under 64-bit linux and using fpGUI. All other
platforms has a clear 'IsMultiThreaded := True' in the RTL code, but
not for Unix. It seems CheckSynchronized() is never called in
fpGUI/X11 because IsMultiThread is never True, even though I have
'cthreads' unit defined as the first unit in my fpGUI program.


-------------[ rtl/unix/cthreads.pp]------------------
....
      { Initialize multithreading if not done }
      if not IsMultiThread then
        begin
          if (InterLockedExchange(longint(IsMultiThread),ord(true)) = 0) then
            begin
              { We're still running in single thread mode, setup the TLS }
              pthread_key_create(@TLSKey,nil);
              InitThreadVars(@CRelocateThreadvar);
            end
        end;
....
-------------------------------


In fpGUI, CheckSynchronized is executed as follows in the main event loop.


....
  if IsMultiThreaded then
    CheckSynchronized();
...


-- 
Regards,
  - Graeme -


_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net:8080/fpgui/



More information about the fpc-pascal mailing list