1. ------------------------------------------------------------------------------ 
  2. --                  GtkAda - Ada95 binding for Gtk+/Gnome                   -- 
  3. --                                                                          -- 
  4. --      Copyright (C) 1998-2000 E. Briot, J. Brobecker and A. Charlet       -- 
  5. --                     Copyright (C) 1998-2014, AdaCore                     -- 
  6. --                                                                          -- 
  7. -- This library is free software;  you can redistribute it and/or modify it -- 
  8. -- under terms of the  GNU General Public License  as published by the Free -- 
  9. -- Software  Foundation;  either version 3,  or (at your  option) any later -- 
  10. -- version. This library is distributed in the hope that it will be useful, -- 
  11. -- but WITHOUT ANY WARRANTY;  without even the implied warranty of MERCHAN- -- 
  12. -- TABILITY or FITNESS FOR A PARTICULAR PURPOSE.                            -- 
  13. --                                                                          -- 
  14. -- As a special exception under Section 7 of GPL version 3, you are granted -- 
  15. -- additional permissions described in the GCC Runtime Library Exception,   -- 
  16. -- version 3.1, as published by the Free Software Foundation.               -- 
  17. --                                                                          -- 
  18. -- You should have received a copy of the GNU General Public License and    -- 
  19. -- a copy of the GCC Runtime Library Exception along with this program;     -- 
  20. -- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    -- 
  21. -- <http://www.gnu.org/licenses/>.                                          -- 
  22. --                                                                          -- 
  23. ------------------------------------------------------------------------------ 
  24.  
  25. --  <description> 
  26. -- 
  27. --  This package provides simple primitives to write multi-threaded 
  28. --  applications with GtkAda. See the GtkAda User's Guide for more details 
  29. --  (section Tasking with GtkAda). 
  30. -- 
  31. --  </description> 
  32. --  <c_version>1.3.6</c_version> 
  33. --  <group>Gdk, the low-level API</group> 
  34.  
  35. with System; 
  36.  
  37. package Gdk.Threads is 
  38.  
  39.    procedure G_Init (Vtable : System.Address := System.Null_Address); 
  40.    --  Initialize the Glib internal threading support. 
  41.    --  This procedure must be called before any call to Enter or Leave. 
  42.    --  The parameter Vtable should never be used for now. 
  43.  
  44.    procedure Init; 
  45.    --  Initialize the Gdk internal threading support. 
  46.    --  This function must be called after G_Init and before any call to 
  47.    --  Enter or Leave. 
  48.  
  49.    procedure Enter; 
  50.    --  Take the GtkAda global lock. 
  51.    --  See the GtkAda User's Guide for more details (section Tasking with 
  52.    --  GtkAda). 
  53.  
  54.    procedure Leave; 
  55.    --  Release the GtkAda global lock. 
  56.    --  See the GtkAda User's Guide for more details (section Tasking with 
  57.    --  GtkAda). 
  58.  
  59. private 
  60.    pragma Linker_Options ("-lgthread-2.0"); 
  61.    --  This is needed to resolve g_thread_init 
  62.  
  63.    pragma Import (C, G_Init, "g_thread_init"); 
  64.    pragma Import (C, Init, "gdk_threads_init"); 
  65.    pragma Import (C, Enter, "gdk_threads_enter"); 
  66.    pragma Import (C, Leave, "gdk_threads_leave"); 
  67. end Gdk.Threads;