------- Additional Comments From dannysmith at users dot sourceforge dot net  
2005-03-20 01:26 -------
Oops, I had split up the patch into a non-critical (as far as
this bug report is concerned) part and a critical part, but messed up when
I pasted into bug report.

Following is the part for Self

In reply to other query in comment #5

The behaviour of TlsGetValue (and the reason for it) is documented, so when
users call it directly, they should know to save and restore the error code
if they want to.

The calls in s-taprop.adb are indirect calls by an internal Ada function, so
users wouldn't know that they should do anything special.

It affects not just windows socket errors, but any error code set by a win32api
function 

But if, as you say, its out of the question to fix this, I won't waste
any more time caring about it.  Perhaps I need to investigate the efects of
these Get/SetLastError calls on c++ code (they are used in gthr-win32.c)

Danny


Index: s-taprop-mingw.adb
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ada/s-taprop-mingw.adb,v
retrieving revision 1.7
diff -c -3 -p -r1.7 s-taprop-mingw.adb
*** s-taprop-mingw.adb  10 Feb 2005 13:57:21 -0000      1.7
--- s-taprop-mingw.adb  20 Mar 2005 00:49:58 -0000
*************** package body System.Task_Primitives.Oper
*** 367,381 ****
     -- Self --
     ----------
  
!    function Self return Task_Id is
!       Self_Id : constant Task_Id := To_Task_Id (TlsGetValue (TlsIndex));
!    begin
!       if Self_Id = null then
!          return Register_Foreign_Thread (GetCurrentThread);
!       else
!          return Self_Id;
!       end if;
!    end Self;
  
     ---------------------
     -- Initialize_Lock --
--- 381,400 ----
     -- Self --
     ----------
  
!      function Self return Task_ID is
!         Saved_Err_Code : DWORD;
!         Self_Id        : Task_ID;
!   
!      begin
!         Saved_Err_Code := GetLastError;
!         Self_Id := To_Task_Id (TlsGetValue (TlsIndex));
!         if Self_Id = null then
!            return Register_Foreign_Thread (GetCurrentThread);
!         else
!            SetLastError (Saved_Err_Code);
!            return Self_Id;
!         end if;
!      end Self;
  
     ---------------------
     -- Initialize_Lock --

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19526

Reply via email to