diff options
author | bosch <bosch@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-10-26 16:09:47 +0000 |
---|---|---|
committer | bosch <bosch@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-10-26 16:09:47 +0000 |
commit | f1919bc08041d359d38f4810bcf2437618418699 (patch) | |
tree | b294124ef4da82ad9b0a331f660f48f02e52d779 /gcc/ada/5ztaprop.adb | |
parent | ff540fb068b6274bd0b1c88cccf01b1cfdd19ef6 (diff) | |
download | gcc-f1919bc08041d359d38f4810bcf2437618418699.tar.gz |
* 5zosinte.ads (null_pthread): new constant.
* 5ztaprop.adb:
(Initialize_TCB): Initialize thread ID to null, to be able to verify
later that this field has been set.
(Finalize_TCB): ditto.
(Suspend_Task): Verify that the thread ID is not null before using it.
(Resume_Task): ditto.
* s-tasdeb.adb:
(Resume_All_Tasks): Lock the tasks list before using it.
(Suspend_All_Tasks): ditto.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@46548 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/5ztaprop.adb')
-rw-r--r-- | gcc/ada/5ztaprop.adb | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/gcc/ada/5ztaprop.adb b/gcc/ada/5ztaprop.adb index b543ae23b33..0d9538c3b0f 100644 --- a/gcc/ada/5ztaprop.adb +++ b/gcc/ada/5ztaprop.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- $Revision: 1.41 $ +-- $Revision$ -- -- -- Copyright (C) 1991-2001 Florida State University -- -- -- @@ -728,6 +728,8 @@ package body System.Task_Primitives.Operations is Cond_Attr : aliased pthread_condattr_t; begin + Self_ID.Common.LL.Thread := null_pthread; + Result := pthread_mutexattr_init (Mutex_Attr'Access); pragma Assert (Result = 0 or else Result = ENOMEM); @@ -898,6 +900,8 @@ package body System.Task_Primitives.Operations is Unchecked_Deallocation (Ada_Task_Control_Block, Task_ID); begin + T.Common.LL.Thread := null_pthread; + Result := pthread_mutex_destroy (T.Common.LL.L'Access); pragma Assert (Result = 0); @@ -989,7 +993,9 @@ package body System.Task_Primitives.Operations is (T : ST.Task_ID; Thread_Self : Thread_Id) return Boolean is begin - if T.Common.LL.Thread /= Thread_Self then + if T.Common.LL.Thread /= null_pthread + and then T.Common.LL.Thread /= Thread_Self + then return taskSuspend (T.Common.LL.Thread) = 0; else return True; @@ -1004,7 +1010,9 @@ package body System.Task_Primitives.Operations is (T : ST.Task_ID; Thread_Self : Thread_Id) return Boolean is begin - if T.Common.LL.Thread /= Thread_Self then + if T.Common.LL.Thread /= null_pthread + and then T.Common.LL.Thread /= Thread_Self + then return taskResume (T.Common.LL.Thread) = 0; else return True; |