Add base::this_thread::native_handle() function

This commit is contained in:
David Capello 2016-06-28 10:22:32 -03:00
parent e1828ca6f3
commit 73843ea564
4 changed files with 18 additions and 4 deletions

View File

@ -1,4 +1,4 @@
Copyright (c) 2001-2015 David Capello Copyright (c) 2001-2016 David Capello
Permission is hereby granted, free of charge, to any person obtaining Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the a copy of this software and associated documentation files (the

View File

@ -1,5 +1,5 @@
# Aseprite Base Library # Aseprite Base Library
*Copyright (C) 2001-2015 David Capello* *Copyright (C) 2001-2016 David Capello*
> Distributed under [MIT license](LICENSE.txt) > Distributed under [MIT license](LICENSE.txt)

View File

@ -1,5 +1,5 @@
// Aseprite Base Library // Aseprite Base Library
// Copyright (c) 2001-2013, 2015 David Capello // Copyright (c) 2001-2016 David Capello
// //
// This file is released under the terms of the MIT license. // This file is released under the terms of the MIT license.
// Read LICENSE.txt for more information. // Read LICENSE.txt for more information.
@ -152,3 +152,16 @@ void base::this_thread::sleep_for(double seconds)
#endif #endif
} }
base::thread::native_handle_type base::this_thread::native_handle()
{
#ifdef _WIN32
return GetCurrentThread();
#else
return (void*)pthread_self();
#endif
}

View File

@ -1,5 +1,5 @@
// Aseprite Base Library // Aseprite Base Library
// Copyright (c) 2001-2013 David Capello // Copyright (c) 2001-2016 David Capello
// //
// This file is released under the terms of the MIT license. // This file is released under the terms of the MIT license.
// Read LICENSE.txt for more information. // Read LICENSE.txt for more information.
@ -92,6 +92,7 @@ namespace base { // Based on C++0x threads lib
{ {
void yield(); void yield();
void sleep_for(double seconds); void sleep_for(double seconds);
thread::native_handle_type native_handle();
} }
// This class joins the thread in its destructor. // This class joins the thread in its destructor.