Commit Graph

1335 Commits

Author SHA1 Message Date
Andrey Semashev
8633d7532d Rewritten GetTickCount64 emulation implementation.
This is to resolve the possible license violation as the previous
implementation has been taken from StackOverflow and was not licensed
under the Boost Software License. The new implementation was adopted from
Boost.Log:

1cc577cbf5/src/timestamp.cpp (L66-L86)

The legal issue has been raised in:

https://lists.boost.org/Archives/boost/2018/02/241453.php

Fixes https://github.com/boostorg/thread/issues/209.
2018-02-21 00:44:20 +03:00
Vicente J. Botet Escriba
03acfa57a2 Merge branch 'master' into develop 2018-02-20 18:04:56 +01:00
Vicente J. Botet Escriba
9be0996062 merge develop (timespec_clocks). 2018-02-20 17:52:51 +01:00
Austin Beer
71231fb2ae Remove unnecessary inline keyword from templated functions 2018-02-16 11:38:45 -07:00
Vicente J. Botet Escriba
ff5031db9e Merge branch 'develop' into feature/timespec_clocks 2018-02-14 19:05:50 +01:00
Austin Beer
96484ac57f Replace hard-coded poll interval with BOOST_THREAD_POLL_INTERVAL_MILLISECONDS 2018-02-12 16:52:22 -07:00
Austin Beer
3b7ca04408 Improve when and where the inline keyword is used. 2018-02-12 13:54:50 -07:00
Vicente J. Botet Escriba
473648ce6c fix ODR issue when future continuations are enabled. #193 future_then unit test contains two different implementations of do_continuation function. 2018-02-10 14:12:25 +01:00
Vicente J. Botet Escriba
426636b1d0
Merge pull request #204 from shinobu-x/wip-future-0002
Missing destructor
2018-02-03 09:26:55 +01:00
Shinobu Kinjo
cb322cfa86 Missing destructor 2018-02-02 17:38:27 +09:00
Vicente J. Botet Escriba
f855cb31d1 merge from develop with some winapp merge issues. 2018-01-28 14:37:53 +01:00
Shinobu Kinjo
f83e887d53 Not *_FUNTION_* but *_FUNCTION_* 2018-01-26 10:03:16 +09:00
Shinobu Kinjo
072bbee63e future.hpp:
1) Removed redundant access specifiers and unused variables in future_deferred_shared_state
2) check lock before unlock
2018-01-23 04:58:13 +09:00
Nikita Kniazev
7ab14ac4a3 future.hpp: Fixed name shadowing 2017-12-24 03:28:43 +03:00
Austin Beer
610c3ae071 Fix issues with v2/shared_mutex.hpp
* Fixed try_unlock_shared_and_lock_until/for() and
  try_unlock_shared_and_lock_upgrade_until/for() so that they wait on the
  correct condition variable for the associated predicate.
* Fixed try_unlock_shared_and_lock_until/for() and
  try_unlock_upgrade_and_lock_until/for() so that they take the
  write_entered_ flag before waiting for all shared readers to unlock. This
  prevents new readers from taking a shared lock or new writers from taking
  the exclusive lock while these functions are waiting to take the
  exclusive lock.
* Changed notify_all() calls to occur while the mutex is being held to be
  consistent with the notify_one() calls and the existing
  pthread/shared_mutex.hpp implementation.
* Added BOOST_THREAD_PROVIDES_SHARED_MUTEX_UPWARDS_CONVERSIONS ifdefs.
* Added BOOST_ASSERT() statements to verify correct usage and operation.
* Fixed an incorrect test case that the BOOST_ASSERT() statements
  uncovered.
* Added comments to explain certain design decisions.
2017-12-20 12:26:09 -07:00
Austin Beer
b2903a5d14 Fix v2/shared_mutex.hpp time jump issues 2017-12-20 12:14:59 -07:00
Austin Beer
81f3a78b8a Rearrange v2/shared_mutex.hpp so related functions appear together
* Added checks for BOOST_THREAD_USES_CHRONO
* Rearranged the order of the functions in v2/shared_mutex.hpp
* No changes were made to the contents of any functions
2017-12-19 14:14:17 -07:00
Austin Beer
e5224ee27a Fix win32 shared_mutex time jump issues 2017-12-19 09:42:54 -07:00
Austin Beer
d77affc6f5 Fix win32 mutex and recursive_mutex time jump issues
* Also added comments to the win32 mutex implementations to clarify
  how the existing code works
* Also removed a few unnecessary intermediate variables
2017-12-19 09:42:46 -07:00
Austin Beer
e96516d10d Fix sync queue time jump issues
* Used the predicate version of condition_variable::wait_until() which
  correctly handles time jump events.

* Fixed an issue with sync_timed_queue::pull_until()/pull_for() where
  they could incorrectly return queue_op_status::timeout instead of
  queue_op_status::success.

* Changed sync_timed_queue::wait_pull() to return
  queue_op_status::success instead of queue_op_status::closed when the
  queue has been closed but an item is available and is ready to be
  pulled off the queue.

* Changed sync_priority_queue::pull_until()/pull_for() and
  sync_timed_queue::pull_until()/pull_for() to return
  queue_op_status::closed instead of throwing an exception when the
  queue is closed since they have a queue_op_status return type.
2017-11-07 21:14:35 -07:00
Austin Beer
907e827046 Add support for BOOST_THREAD_V2_SHARED_MUTEX
BOOST_THREAD_V2_SHARED_MUTEX allows users to use v2/shared_mutex.hpp
instead of pthread/shared_mutex.hpp or win32/shared_mutex.hpp.
2017-11-07 16:48:59 -07:00
Aleksey Katargin
609d1a7be0
allow sync policy for future then continuation (fix #111) 2017-11-01 11:40:50 +03:00
Austin Beer
1e84b978b2 Use CLOCK_MONOTONIC by default
- Eliminated BOOST_THREAD_HAS_CONDATTR_SET_CLOCK_MONOTONIC.
- CLOCK_MONOTONIC is now always used whenever it is available.
2017-10-26 08:07:49 -06:00
Austin Beer
2de04292da Rename CD to common_duration to match Boost Chrono
See https://github.com/boostorg/chrono/pull/23
2017-10-26 07:54:04 -06:00
Austin Beer
c50428f612 Use direct initialization instead of assignment 2017-10-26 07:53:49 -06:00
Austin Beer
b4348b3cff Clean up detail/thread.hpp so all of the chrono functions are together 2017-10-26 07:53:37 -06:00
Austin Beer
fea3e33128 Remove empty v2/thread.hpp file 2017-10-26 07:53:24 -06:00
Austin Beer
d60a11a75b Delete unused file: pthread/shared_mutex_assert.hpp 2017-10-26 07:53:15 -06:00
Austin Beer
cfd93c7747 Correct a fix that I previously implemented incorrectly 2017-10-26 07:52:42 -06:00
Andrey Semashev
343230cd78 Updated Boost.WinAPI usage to the new location and namespace. 2017-10-25 01:09:24 +03:00
Vicente J. Botet Escriba
6d7bc558d0 Implement mono_platform_clock and mono_platform_timepoint fro MacOs. 2017-10-23 22:40:49 +02:00
Vicente J. Botet Escriba
d345533596 move files from boost/detail to boost/thread/detail. 2017-10-19 18:14:37 +02:00
Vicente J. Botet Escriba
6ddf6a8acf Merge pull request #180 from austin-beer/feature/timespec_clocks_pr19_no_int_sleep_on_win
Add and fix sleep functions
2017-10-15 18:27:19 +02:00
Austin Beer
3c01e39481 Add and fix sleep functions
- Added no_interruption_point::sleep() functions to pthreads to be
  consistent with Windows.
- Fixed an issue where the no_interruption_point::sleep_*() functions
  were still interruptible on Windows.
2017-10-13 11:48:05 -06:00
Austin Beer
eef7293932 Updated pthread/shared_mutex and future to use predicate wait functions.
- This allowed these classes to take advantage of the time jump fixes in condition_variable.
Fixed a minor issue where, if a thread was waiting after calling one of the following functions and it timed out at the same time it was given the lock, it would return false (failure) rather than succeeding.
- mutex::timed_lock()
- mutex::try_lock_for()
- mutex::try_lock_until()
- recursive_mutex::timed_lock()
- recursive_mutex::try_lock_for()
- recursive_mutex::try_lock_until()
- shared_mutex::timed_lock_shared()
- shared_mutex::try_lock_shared_for()
- shared_mutex::try_lock_shared_until()
2017-10-13 11:47:46 -06:00
Austin Beer
b65b2f3fea Reverted future.hpp and pthread/shared_mutex.hpp back to the versions in the develop branch. This discarded all changes made to these two files in the feature/timespec_clocks branch to date. 2017-10-13 11:47:46 -06:00
Austin Beer
7069c97a8b Fixing lost notification bugs, part 1
- Updated all of the functions in all of the condition variable classes to ensure that they don't lose notifications
- Re-enabled notification tests
2017-10-11 10:03:04 -06:00
Vicente J. Botet Escriba
3b5d0c8d7f fix meger issues from develop. Disable notification_lost test as need to be fixed for macos. 2017-10-11 09:32:19 +02:00
Vicente J. Botet Escriba
517f1efc56 replace check by unlock_if_locked as some OsX define a check macro. 2017-10-04 23:33:48 +02:00
Austin Beer
82e2c82e95 Renaming timespec to platform 2017-10-02 09:23:54 -06:00
Vicente J. Botet Escriba
178e0661ab fix bad clock:: use, shoudl be chrono::steady_clock. 2017-10-02 08:59:41 +02:00
Vicente J. Botet Escriba
9f7e37c892 Merge branch 'develop' into feature/timespec_clocks 2017-10-01 13:28:57 +02:00
Vicente J. Botet Escriba
995033cf20 Make sync_timed_queue more general adding a TimePoint parameter and fix the inteface of all the time related functions _for/_until to take generic chrono::timepoints and chrono::durations. 2017-09-30 12:15:06 +02:00
Austin Beer
659d309206 Re-enabled tests on Windows that had been temporarily disabled. 2017-09-29 15:53:21 -06:00
Austin Beer
847dcbf237 Removed unnecessary explicit qualifiers. 2017-09-29 15:28:04 -06:00
Austin Beer
35d25851ce * Reverted some of my Windows updates to get a condition variable test on Windows to pass again. Further analysis is needed to determine why the updates didn't work.
* Increased the range of one test so it passes on Windows.
2017-09-29 14:52:42 -06:00
Austin Beer
5ffca91e60 * Hopefully fixed the build failure on Mac OS.
* Refactored to use timespec as the internal storage with pthread and intmax_t with Windows.
2017-09-29 10:22:01 -06:00
Austin Beer
3c25ad09ce Attempting to fix build errors on Windows. 2017-09-29 00:34:47 -06:00
Austin Beer
a2e037bb54 Fixes and Cleanup
- Fixed build failures on Windows. The timespec struct is not supported by older versions of Visual Studio. I changed the internal representation inside of the *_timespec_timepoint classes to a boost::intmax_t representing the number of nanoseconds since the epoch.
- Fixed some functions that wouldn't execute at all if they were provided a negative time duration or an absolute time that was in the past. From what I understand, they should instead execute once and then return immediately.
- Moved pthread/timespec.hpp to detail/timespec.hpp.
- Deleted detail/internal_clock.hpp and moved the seven relevant lines into detail/timespec.hpp. This keeps all of the internal clock declarations in one place.
- Renamed thread_detail::internal_clock_t to detail::internal_chrono_clock to be consistent with and yet clearly differentiated from detail::internal_timespec_clock.
- Removed "using namespace chrono" to eliminate ambiguious namespace resolution when referencing detail::internal_chrono_clock.
- Re-enabled a few tests on Windows that had previously been disabled. I want to see whether or not they still need to be disabled.
2017-09-28 22:27:37 -06:00
Austin Beer
c2b207faa4 Switching the Windows condition_variable and interruptible_wait functions over to using internal_timespec_clock. 2017-09-28 13:24:21 -06:00
Austin Beer
29c3b48da0 Switching over to using the existing GetTickCount64() code for reporting monotonic time on Windows. This code is less precise than QueryPerformanceCounter(), but it's more reliable on older versions of Windows (e.g. XP and Server 2003). 2017-09-27 15:40:50 -06:00
Austin Beer
13713f3b9c Added support for getting time on Windows to the timespec classes. 2017-09-27 10:52:53 -06:00
Vicente J. Botet Escriba
46c1ae6f96 Merge branch 'develop' into feature/timespec_clocks 2017-09-26 05:55:40 +02:00
Austin Beer
417a2d8a46 Fixed compile issue on Windows. 2017-09-25 11:15:09 -06:00
Vicente J. Botet Escriba
ce7f2b09cc try to use again pthread/shared_mutex.hpp on windows. Comment not used functions in timespec. 2017-09-25 12:52:25 +02:00
Vicente J. Botet Escriba
e6226a95ba try to fix future wait on posix duration. 2017-09-25 08:39:45 +02:00
Vicente J. Botet Escriba
aa221d02b5 try to fix issues on linu-mono mutex operation on system_time. 2017-09-25 00:18:12 +02:00
Vicente J. Botet Escriba
dd1b5282b2 try to fix issues with windows and shared_mutex. 2017-09-24 17:29:27 +02:00
Vicente J. Botet Escriba
45321f0570 try to fix issues with new pthread/shared_mutex.hpp on windows by disabling the use of the pthread version that now depends on timespec. 2017-09-24 16:31:42 +02:00
Daniela Engert
4e83359537
fix or silence (msvc) compiler warnings about constant conditional expressions, unused parameters, narrowing, unreachable code, use of 'this' in base member initializations, and some other minor stuff
Signed-off-by: Daniela Engert <dani@ngrt.de>
2017-09-24 14:02:17 +02:00
Vicente J. Botet Escriba
bafc9f43a5 try to fix DateTime time related issues on pthread/shared_mutex.hpp. 2017-09-24 08:12:02 +02:00
Vicente J. Botet Escriba
b98d022d40 try to fix DatTime related functions for mutex/recursive_mutex. 2017-09-23 08:42:02 +02:00
Austin Beer
aeb54ddbe5 Finished fixing the condition_variable[_any] timed_wait() functions. 2017-09-22 14:22:06 -06:00
Vicente J. Botet Escriba
4d385bedd3 try to fix condition_variable::timed_wait for pthread. 2017-09-22 04:18:55 +02:00
Vicente J. Botet Escriba
03a2ea4612 Merge pull request #159 from austin-beer/feature/timespec_clocks_pr6
Fixed try_join_* and timed_join functions that were failing time jump tests
2017-09-22 00:37:20 +02:00
Austin Beer
c290fc5f98 Deleted an unused function and added some fixme comments. 2017-09-21 12:59:09 -06:00
Austin Beer
23861b9608 Fixed try_lock_*for() and wait_for() functions that were failing time jump tests. 2017-09-21 12:08:20 -06:00
Austin Beer
24fd5953c9 Fixed timed_join on Windows when the system clock jumps. 2017-09-21 11:27:36 -06:00
Austin Beer
8f51d9c4a7 Fixed try_join_* and timed_join functions that were failing time jump tests 2017-09-21 10:56:53 -06:00
Vicente J. Botet Escriba
5dcc5f6d26 Merge branch 'develop' into feature/timespec_clocks 2017-09-21 18:53:52 +02:00
Austin Beer
8207b88e97 Made function static 2017-09-21 10:48:58 -06:00
Austin Beer
de7e354a8e Improved the timespec implementation
* Added a constructor to timespec_duration, real_timespec_timepoint, and mono_timespec_timepoint that takes an intmax_t representing the number of nanoseconds in the timespec.
* Added a getNs() function to timespec_duration, real_timespec_timepoint, and mono_timespec_timepoint that returns an intmax_t representing the number of nanoseconds in the timespec.
* Added a timespec_milliseconds() function that takes an integer representing milliseconds and returns a timespec_duration.
* Removed some unnecessary BOOST_SYMBOL_VISIBLE declarations.
* Removed the unnecessary d100 variable declarations.
2017-09-21 09:28:18 -06:00
Austin Beer
2f1b1c4d44 Missed a file in the previous commit. 2017-09-20 12:49:22 -06:00
Austin Beer
d8f24d9183 Fixed an issue where the results of Chrono arithmetic operations weren't being assigned to a common type that's guaranteed to compile. 2017-09-20 12:49:22 -06:00
Austin Beer
0fa843532e Eliminated unnecessary convertions to chrono::nanoseconds 2017-09-20 12:49:21 -06:00
Austin Beer
e6f876e830 More Cleanup
* Deleted unused sleep_for() overload in pthread/thread_data.hpp.
* Deleted unused and disabled sleep_for() overloads in win32/thread_data.hpp.
2017-09-20 10:10:17 -06:00
Austin Beer
285d35f43f Cleanup
* Deleted a couple of unnecessary calls to internal_clock_t::now() in v2/thread.hpp.
* Deleted the hidden::sleep_until() functions, which are no longer being used.
* Deleted the condition_variable::do_wait_for() function, which is no longer being used.
* Deleted the sleep_mutex and sleep_condition variables in pthread/thread_data.hpp, which are no longer being used.
2017-09-19 16:12:22 -06:00
Vicente J. Botet Escriba
a18dfa1fea Merge branch 'feature/timespec_clocks' of github.com:boostorg/thread into feature/timespec_clocks 2017-09-19 23:46:45 +02:00
Vicente J. Botet Escriba
4329e5be07 Merge pull request #150 from boostorg/feature/promise_deferred
Feature/promise deferred
2017-09-19 23:42:08 +02:00
Vicente J. Botet Escriba
962ef813b4 Merge branch 'develop' of github.com:boostorg/thread into develop 2017-09-19 23:31:09 +02:00
Vicente J. Botet Escriba
1c51b5d9b8 fix may-alias issue. 2017-09-19 23:30:42 +02:00
Austin Beer
a9706f0745 Fixed sleep(TimeDuration const& rel_time) when internal clock is not monotonic but CLOCK_MONOTONIC is available. 2017-09-19 15:06:06 -06:00
Vicente J. Botet Escriba
8e718893e5 Merge branch 'feature/timespec_clocks' of github.com:boostorg/thread into feature/timespec_clocks 2017-09-19 22:09:38 +02:00
Austin Beer
f1dec7935f Rearranged a couple of functions to simplify the #if/#else logic. 2017-09-19 13:22:13 -06:00
Vicente J. Botet Escriba
732f8c7458 Merge pull request #152 from shinobu-x/sk_detail_move_fix_001
Do not include same headers twice
2017-09-19 20:39:07 +02:00
Shinobu Kinjo
dd66147e07 Do not include same headers twice 2017-09-20 03:06:10 +09:00
Austin Beer
aebbcda3fe Updates to fix interruption-point inconsistencies.
* Fixed the interruption-point versions of sleep_for/sleep_until() to always use condition variables.
* Fixed the no-interruption-point versions of sleep_for/sleep_until() to use pthread_delay_np or nanosleep whenever possible.
* Updated hidden::sleep_for() to always use a condition variable.
* Updated no_interruption_point::hidden::sleep_for() to use pthread_delay_np or nanosleep whenever possible.
2017-09-19 09:04:57 -06:00
Vicente J. Botet Escriba
5b4d230d4a Merge branch 'develop' into feature/timespec_clocks 2017-09-19 13:01:20 +02:00
Vicente J. Botet Escriba
48a2a960da remove some warnings. 2017-09-19 03:20:46 +02:00
Vicente J. Botet Escriba
9813c81ef3 Added missing include. 2017-09-18 02:44:37 +02:00
Vicente J. Botet Escriba
65989edb97 Added promise deferred functions. 2017-09-18 02:22:49 +02:00
Vicente J. Botet Escriba
576231942d Merge branch 'develop' into feature/timespec_clocks 2017-09-17 22:40:59 +02:00
Vicente J. Botet Escriba
56016e8348 reinplement sleep(system_time) as proposed by Austin Beer. 2017-09-17 19:08:51 +02:00
Vicente J. Botet Escriba
b6b6a6944a remove redundant chrono:: 2017-09-17 18:45:05 +02:00
Edward Diener
dfb64a5af5 Removed executable attribute. 2017-09-17 08:51:10 -04:00
Andrey Semashev
b64aad9869 Changed _pRawDllMain and related types to use HINSTANCE instead of HANDLE.
In MSVC-9 MFC sources, _pRawDllMain and ExtRawDllMain accept HINSTANCE as
the first argument, not HANDLE. In strict mode these are different types,
which creates the potential for ODR errors. This commit resolves that
inconsistency.

Resolves https://svn.boost.org/trac10/ticket/12323.
2017-09-16 20:47:10 +03:00
Vicente J. Botet Escriba
c689b6205c Merge pull request #146 from shinobu-x/sk_scheduling_adaptor_fix_001
Inappropriate class name
2017-09-16 14:50:28 +02:00
Shinobu Kinjo
03431ae64f modified: include/boost/thread/executors/scheduling_adaptor.hpp
modified:   test/test_scheduling_adaptor.cpp
2017-09-16 15:41:18 +09:00
Vicente J. Botet Escriba
14deba107f minor chnages. 2017-09-07 22:41:31 +02:00
Vicente J. Botet Escriba
99e2867a21 add missing t-d100 as reported by Autin. 2017-09-06 23:39:29 +02:00