Commit 009c0268 by Arnaud Charlet

[multiple changes]

2016-04-19  Olivier Hainque  <hainque@adacore.com>

	* par_sco.adb (Traverse_One, case N_Case_Statement):
	Skip pragmas before the first alternative.
	(Traverse_Handled_Statement_Sequence, Exception_Handlers): Likewise.

2016-04-19  Tristan Gingold  <gingold@adacore.com>

	* adaint.c (__gnat_lwp_self): New function (for darwin).
	* s-osinte-darwin.ads, s-osinte-darwin.adb (lwp_self): Import
	of __gnat_lwp_self.

From-SVN: r235204
parent 65f52ee9
2016-04-19 Olivier Hainque <hainque@adacore.com> 2016-04-19 Olivier Hainque <hainque@adacore.com>
* par_sco.adb (Traverse_One, case N_Case_Statement):
Skip pragmas before the first alternative.
(Traverse_Handled_Statement_Sequence, Exception_Handlers): Likewise.
2016-04-19 Tristan Gingold <gingold@adacore.com>
* adaint.c (__gnat_lwp_self): New function (for darwin).
* s-osinte-darwin.ads, s-osinte-darwin.adb (lwp_self): Import
of __gnat_lwp_self.
2016-04-19 Olivier Hainque <hainque@adacore.com>
* sem_util.adb (Build_Elaboration_Entity): Always request an * sem_util.adb (Build_Elaboration_Entity): Always request an
elab counter when preserving control-flow. elab counter when preserving control-flow.
......
...@@ -3101,6 +3101,30 @@ __gnat_lwp_self (void) ...@@ -3101,6 +3101,30 @@ __gnat_lwp_self (void)
} }
#endif #endif
#if defined (__APPLE__)
#include <mach/thread_info.h>
#include <mach/mach_init.h>
#include <mach/thread_act.h>
/* System-wide thread identifier. Note it could be truncated on 32 bit
hosts.
Previously was: pthread_mach_thread_np (pthread_self ()). */
void *
__gnat_lwp_self (void)
{
thread_identifier_info_data_t data;
mach_msg_type_number_t count = THREAD_IDENTIFIER_INFO_COUNT;
kern_return_t kret;
kret = thread_info (mach_thread_self (), THREAD_IDENTIFIER_INFO,
(thread_info_t) &data, &count);
if (kret == KERN_SUCCESS)
return (void *)(uintptr_t)data.thread_id;
else
return 0;
}
#endif
#if defined (__linux__) #if defined (__linux__)
#include <sched.h> #include <sched.h>
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 1999-2014, Free Software Foundation, Inc. -- -- Copyright (C) 1999-2015, Free Software Foundation, Inc. --
-- -- -- --
-- GNARL is free software; you can redistribute it and/or modify it under -- -- GNARL is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -172,17 +172,6 @@ package body System.OS_Interface is ...@@ -172,17 +172,6 @@ package body System.OS_Interface is
return 0; return 0;
end sched_yield; end sched_yield;
--------------
-- lwp_self --
--------------
function lwp_self return Address is
function pthread_mach_thread_np (thread : pthread_t) return Address;
pragma Import (C, pthread_mach_thread_np, "pthread_mach_thread_np");
begin
return pthread_mach_thread_np (pthread_self);
end lwp_self;
------------------ ------------------
-- pthread_init -- -- pthread_init --
------------------ ------------------
......
...@@ -228,6 +228,7 @@ package System.OS_Interface is ...@@ -228,6 +228,7 @@ package System.OS_Interface is
--------- ---------
function lwp_self return System.Address; function lwp_self return System.Address;
pragma Import (C, lwp_self, "__gnat_lwp_self");
-- Return the mach thread bound to the current thread. The value is not -- Return the mach thread bound to the current thread. The value is not
-- used by the run-time library but made available to debuggers. -- used by the run-time library but made available to debuggers.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment