File : s-tpopsp-vxworks-raven-cert-rtp.adb


   1 ------------------------------------------------------------------------------
   2 --                                                                          --
   3 --                 GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS                 --
   4 --                                                                          --
   5 --                SYSTEM.TASK_PRIMITIVES.OPERATIONS.SPECIFIC                --
   6 --                                                                          --
   7 --                                 B o d y                                  --
   8 --                                                                          --
   9 --                      Copyright (C) 1998-2015, AdaCore                    --
  10 --                                                                          --
  11 -- GNAT is free software;  you can  redistribute it  and/or modify it under --
  12 -- terms of the  GNU General Public License as published  by the Free Soft- --
  13 -- ware  Foundation;  either version 3,  or (at your option) any later ver- --
  14 -- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
  15 -- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
  16 -- or FITNESS FOR A PARTICULAR PURPOSE.                                     --
  17 --                                                                          --
  18 --                                                                          --
  19 --                                                                          --
  20 --                                                                          --
  21 --                                                                          --
  22 -- GNAT was originally developed  by the GNAT team at  New York University. --
  23 -- Extensive contributions were provided by Ada Core Technologies Inc.      --
  24 --                                                                          --
  25 ------------------------------------------------------------------------------
  26 
  27 --  This is a VxWorks version of this package using Thread_Local_Storage
  28 --  support for use with ravenscar-cert-rtp. It assumes VxWorks Cert 6.6.3 or
  29 --  more recent. The implementation is based on __threads support.
  30 
  31 separate (System.Task_Primitives.Operations)
  32 package body Specific is
  33 
  34    ATCB : aliased Task_Id := null;
  35    pragma Thread_Local_Storage (ATCB);
  36    --  Ada Task_Id associated with a thread
  37 
  38    ---------
  39    -- Set --
  40    ---------
  41 
  42    procedure Set (New_Task_Id : Task_Id) is
  43    begin
  44       ATCB := New_Task_Id;
  45    end Set;
  46 
  47    ----------
  48    -- Self --
  49    ----------
  50 
  51    function Self return Task_Id is
  52    begin
  53       return ATCB;
  54    end Self;
  55 
  56 end Specific;