1. ----------------------------------------------------------------------- 
  2. --               GtkAda - Ada95 binding for Gtk+/Gnome               -- 
  3. --                                                                   -- 
  4. --   Copyright (C) 1998-2000 E. Briot, J. Brobecker and A. Charlet   -- 
  5. --                Copyright (C) 2000-2003 ACT-Europe                 -- 
  6. --                                                                   -- 
  7. -- This library is free software; you can redistribute it and/or     -- 
  8. -- modify it under the terms of the GNU General Public               -- 
  9. -- License as published by the Free Software Foundation; either      -- 
  10. -- version 2 of the License, or (at your option) any later version.  -- 
  11. --                                                                   -- 
  12. -- This library is distributed in the hope that it will be useful,   -- 
  13. -- but WITHOUT ANY WARRANTY; without even the implied warranty of    -- 
  14. -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU -- 
  15. -- General Public License for more details.                          -- 
  16. --                                                                   -- 
  17. -- You should have received a copy of the GNU General Public         -- 
  18. -- License along with this library; if not, write to the             -- 
  19. -- Free Software Foundation, Inc., 59 Temple Place - Suite 330,      -- 
  20. -- Boston, MA 02111-1307, USA.                                       -- 
  21. --                                                                   -- 
  22. -- As a special exception, if other files instantiate generics from  -- 
  23. -- this unit, or you link this unit with other files to produce an   -- 
  24. -- executable, this  unit  does not  by itself cause  the resulting  -- 
  25. -- executable to be covered by the GNU General Public License. This  -- 
  26. -- exception does not however invalidate any other reasons why the   -- 
  27. -- executable file  might be covered by the  GNU Public License.     -- 
  28. ----------------------------------------------------------------------- 
  29.  
  30. --  <description> 
  31. -- 
  32. --  This package provides simple primitives to write multi-threaded 
  33. --  applications with GtkAda. See the GtkAda User's Guide for more details 
  34. --  (section Tasking with GtkAda). 
  35. -- 
  36. --  </description> 
  37. --  <c_version>1.3.6</c_version> 
  38. --  <group>Gdk, the low-level API</group> 
  39.  
  40. with System; 
  41.  
  42. package Gdk.Threads is 
  43.  
  44.    procedure G_Init (Vtable : System.Address := System.Null_Address); 
  45.    --  Initialize the Glib internal threading support. 
  46.    --  This procedure must be called before any call to Enter or Leave. 
  47.    --  The parameter Vtable should never be used for now. 
  48.  
  49.    procedure Init; 
  50.    --  Initialize the Gdk internal threading support. 
  51.    --  This function must be called after G_Init and before any call to 
  52.    --  Enter or Leave. 
  53.  
  54.    procedure Enter; 
  55.    --  Take the GtkAda global lock. 
  56.    --  See the GtkAda User's Guide for more details (section Tasking with 
  57.    --  GtkAda). 
  58.  
  59.    procedure Leave; 
  60.    --  Release the GtkAda global lock. 
  61.    --  See the GtkAda User's Guide for more details (section Tasking with 
  62.    --  GtkAda). 
  63.  
  64. private 
  65.    pragma Linker_Options ("-lgthread-2.0"); 
  66.    --  This is needed to resolve g_thread_init 
  67.  
  68.    pragma Import (C, G_Init, "g_thread_init"); 
  69.    pragma Import (C, Init, "gdk_threads_init"); 
  70.    pragma Import (C, Enter, "gdk_threads_enter"); 
  71.    pragma Import (C, Leave, "gdk_threads_leave"); 
  72. end Gdk.Threads;