This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PR14538 patch *-rtems ada fixes


James Morrison wrote:
"Joel Sherrill <joel@OARcorp.com>" <joel.sherrill@OARcorp.com> writes:


Index: ada/5rosinte.ads
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ada/5rosinte.ads,v
retrieving revision 1.5
diff -u -r1.5 5rosinte.ads
--- ada/5rosinte.ads	24 Apr 2003 17:53:51 -0000	1.5
+++ ada/5rosinte.ads	11 Mar 2004 19:22:36 -0000
@@ -229,7 +231,7 @@
   type pthread_attr_t      is limited private;
   type pthread_mutexattr_t is limited private;
   type pthread_condattr_t  is limited private;
-   type pthread_key_t       is private;
+   type pthread_key_t       is new Interfaces.C.unsigned;

PTHREAD_CREATE_DETACHED : constant := 0;

@@ -519,7 +521,5 @@
   type pthread_mutex_t is new rtems_id;

   type pthread_cond_t is new rtems_id;
-
-   type pthread_key_t is new rtems_id;


Why is pthread_key_t no longer opaque?

I was getting a fatal warning that ATCB_Key wasn't initialized. Since RTEMS is using an optimized self variable, it didn't actually call pthread_key_create to initialize it, I didn't see another alternative without modifying the shared POSIX code which was more scary. :)

This was the warning

s-taprop.adb:113:04: warning: "ATCB_Key" is never assigned a value

which is the actually the shared POSIX 7staprop.adb.

I think needing the ATCB_Key is only because there is a minor mistake
in that file.  Around line 1021, it is using pthread_setspecific()
when I think it should be using the Set() subprogram provided
by the XXtapopsp.adb.  The following shows what I think is needed:

Index: 7staprop.adb
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ada/7staprop.adb,v
retrieving revision 1.8
diff -u -r1.8 7staprop.adb
--- 7staprop.adb 5 Jan 2004 15:20:43 -0000 1.8
+++ 7staprop.adb 13 Mar 2004 00:02:43 -0000
@@ -110,7 +110,7 @@
-- a time; it is used to execute in mutual exclusion from all other tasks.
-- Used mainly in Single_Lock mode, but also to protect All_Tasks_List


-   ATCB_Key : aliased pthread_key_t;
+   --  ATCB_Key : aliased pthread_key_t;
    --  Key used to find the Ada Task_ID associated with a thread

    Environment_Task_ID : Task_ID;
@@ -1018,8 +1018,9 @@
       Free (Tmp);

       if Is_Self then
-         Result := pthread_setspecific (ATCB_Key, System.Null_Address);
-         pragma Assert (Result = 0);
+         --  Result := pthread_setspecific (ATCB_Key, System.Null_Address);
+         --  pragma Assert (Result = 0);
+         Specific.Set (null);
       end if;

end Finalize_TCB;



--joel


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]