Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
typon-concurrency
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
typon
typon-concurrency
Commits
efb63e76
Commit
efb63e76
authored
May 06, 2022
by
Xavier Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move random.hpp to fundamental
parent
16921d8b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
34 deletions
+18
-34
rt/include/typon/fundamental/random.hpp
rt/include/typon/fundamental/random.hpp
+15
-0
rt/include/typon/random.hpp
rt/include/typon/random.hpp
+0
-32
rt/include/typon/scheduler.hpp
rt/include/typon/scheduler.hpp
+3
-2
No files found.
rt/include/typon/fundamental/random.hpp
0 → 100644
View file @
efb63e76
#ifndef TYPON_FUNDAMENTAL_RANDOM_HPP_INCLUDED
#define TYPON_FUNDAMENTAL_RANDOM_HPP_INCLUDED
#include <random>
namespace
typon
::
fdt
::
random
{
static
thread_local
std
::
mt19937
random
{
std
::
random_device
{}()
};
}
#endif // TYPON_FUNDAMENTAL_RANDOM_HPP_INCLUDED
rt/include/typon/random.hpp
deleted
100644 → 0
View file @
16921d8b
#ifndef TYPON_RANDOM_HPP_INCLUDED
#define TYPON_RANDOM_HPP_INCLUDED
#include <random>
namespace
typon
{
struct
Random
{
std
::
mt19937
_rng
;
Random
()
noexcept
:
_rng
{
std
::
random_device
{}()}
{}
unsigned
int
operator
()()
noexcept
{
return
_rng
();
}
};
namespace
random
{
static
thread_local
Random
random
;
}
}
#endif // TYPON_RANDOM_HPP_INCLUDED
rt/include/typon/scheduler.hpp
View file @
efb63e76
...
@@ -7,10 +7,11 @@
...
@@ -7,10 +7,11 @@
#include <thread>
#include <thread>
#include <vector>
#include <vector>
#include <typon/fundamental/random.hpp>
#include <typon/continuation.hpp>
#include <typon/continuation.hpp>
#include <typon/eventcount.hpp>
#include <typon/eventcount.hpp>
#include <typon/deque.hpp>
#include <typon/deque.hpp>
#include <typon/random.hpp>
namespace
typon
namespace
typon
...
@@ -117,7 +118,7 @@ namespace typon
...
@@ -117,7 +118,7 @@ namespace typon
{
{
for
(
uint
i
=
0
;
i
<
_parallelism
*
2
+
1
;
i
++
)
for
(
uint
i
=
0
;
i
<
_parallelism
*
2
+
1
;
i
++
)
{
{
uint
id
=
random
::
random
()
%
_parallelism
;
uint
id
=
fdt
::
random
::
random
()
%
_parallelism
;
if
(
id
==
thread_id
)
if
(
id
==
thread_id
)
{
{
task
=
_deque
.
back
().
steal
();
task
=
_deque
.
back
().
steal
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment