Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
R
Root
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Admin message
为了安全,强烈建议开启2FA双因子认证:User Settings -> Account -> Enable two-factor authentication!!!
Show more breadcrumbs
cxwx
Root
Commits
e0114376
Commit
e0114376
authored
7 years ago
by
Danilo Piparo
Browse files
Options
Downloads
Patches
Plain Diff
Rename Future TFuture everywhere
parent
c70e9214
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
core/imt/CMakeLists.txt
+1
-1
1 addition, 1 deletion
core/imt/CMakeLists.txt
core/imt/inc/ROOT/TFuture.hxx
+32
-32
32 additions, 32 deletions
core/imt/inc/ROOT/TFuture.hxx
with
33 additions
and
33 deletions
core/imt/CMakeLists.txt
+
1
−
1
View file @
e0114376
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
set
(
sources base.cxx
)
set
(
sources base.cxx
)
if
(
imt
)
if
(
imt
)
set
(
headers ROOT/TPoolManager.hxx ROOT/TThreadExecutor.hxx ROOT/TTaskGroup.hxx ROOT/Future.hxx
)
set
(
headers ROOT/TPoolManager.hxx ROOT/TThreadExecutor.hxx ROOT/TTaskGroup.hxx ROOT/
T
Future.hxx
)
ROOT_GENERATE_DICTIONARY
(
G__Imt
${
headers
}
STAGE1 MODULE Imt LINKDEF LinkDef.h DEPENDENCIES Core Thread BUILTINS TBB
)
# For auto{loading,parsing}
ROOT_GENERATE_DICTIONARY
(
G__Imt
${
headers
}
STAGE1 MODULE Imt LINKDEF LinkDef.h DEPENDENCIES Core Thread BUILTINS TBB
)
# For auto{loading,parsing}
set
(
sources
${
sources
}
TImplicitMT.cxx TThreadExecutor.cxx TPoolManager.cxx TTaskGroup.cxx G__Imt.cxx
)
set
(
sources
${
sources
}
TImplicitMT.cxx TThreadExecutor.cxx TPoolManager.cxx TTaskGroup.cxx G__Imt.cxx
)
endif
()
endif
()
...
...
This diff is collapsed.
Click to expand it.
core/imt/inc/ROOT/Future.hxx
→
core/imt/inc/ROOT/
T
Future.hxx
+
32
−
32
View file @
e0114376
...
@@ -9,8 +9,8 @@
...
@@ -9,8 +9,8 @@
* For the list of contributors see $ROOTSYS/README/CREDITS. *
* For the list of contributors see $ROOTSYS/README/CREDITS. *
*************************************************************************/
*************************************************************************/
#ifndef ROOT_Future
#ifndef ROOT_
T
Future
#define ROOT_Future
#define ROOT_
T
Future
#include
"RConfigure.h"
#include
"RConfigure.h"
...
@@ -32,39 +32,39 @@ namespace ROOT {
...
@@ -32,39 +32,39 @@ namespace ROOT {
// fwd declaration
// fwd declaration
namespace
Experimental
{
namespace
Experimental
{
template
<
typename
T
>
template
<
typename
T
>
class
Future
;
class
T
Future
;
}
}
namespace
Detail
{
namespace
Detail
{
template
<
typename
T
>
template
<
typename
T
>
class
FutureImpl
{
class
T
FutureImpl
{
template
<
typename
V
>
friend
class
Experimental
::
Future
;
template
<
typename
V
>
friend
class
Experimental
::
T
Future
;
protected:
protected:
using
TTaskGroup
=
Experimental
::
TTaskGroup
;
using
TTaskGroup
=
Experimental
::
TTaskGroup
;
std
::
future
<
T
>
fStdFut
;
std
::
future
<
T
>
fStdFut
;
std
::
unique_ptr
<
TTaskGroup
>
fTg
{
nullptr
};
std
::
unique_ptr
<
TTaskGroup
>
fTg
{
nullptr
};
FutureImpl
(
std
::
future
<
T
>
&&
fut
,
std
::
unique_ptr
<
TTaskGroup
>
&&
tg
)
:
fStdFut
(
std
::
move
(
fut
))
{
T
FutureImpl
(
std
::
future
<
T
>
&&
fut
,
std
::
unique_ptr
<
TTaskGroup
>
&&
tg
)
:
fStdFut
(
std
::
move
(
fut
))
{
fTg
=
std
::
move
(
tg
);
fTg
=
std
::
move
(
tg
);
};
};
FutureImpl
(){};
T
FutureImpl
(){};
FutureImpl
(
std
::
future
<
T
>
&&
fut
)
:
fStdFut
(
std
::
move
(
fut
))
{}
T
FutureImpl
(
std
::
future
<
T
>
&&
fut
)
:
fStdFut
(
std
::
move
(
fut
))
{}
FutureImpl
(
FutureImpl
<
T
>
&&
other
)
{
*
this
=
std
::
move
(
other
);
}
T
FutureImpl
(
T
FutureImpl
<
T
>
&&
other
)
{
*
this
=
std
::
move
(
other
);
}
FutureImpl
&
operator
=
(
std
::
future
<
T
>
&&
other
)
T
FutureImpl
&
operator
=
(
std
::
future
<
T
>
&&
other
)
{
{
fStdFut
=
std
::
move
(
other
);
fStdFut
=
std
::
move
(
other
);
}
}
FutureImpl
<
T
>
&
operator
=
(
FutureImpl
<
T
>
&&
other
)
=
default
;
T
FutureImpl
<
T
>
&
operator
=
(
T
FutureImpl
<
T
>
&&
other
)
=
default
;
public
:
public
:
FutureImpl
<
T
>
&
operator
=
(
FutureImpl
<
T
>
&
other
)
=
delete
;
T
FutureImpl
<
T
>
&
operator
=
(
T
FutureImpl
<
T
>
&
other
)
=
delete
;
FutureImpl
(
const
FutureImpl
<
T
>
&
other
)
=
delete
;
T
FutureImpl
(
const
T
FutureImpl
<
T
>
&
other
)
=
delete
;
void
wait
()
{
if
(
fTg
)
fTg
->
Wait
();
}
void
wait
()
{
if
(
fTg
)
fTg
->
Wait
();
}
...
@@ -75,16 +75,16 @@ public:
...
@@ -75,16 +75,16 @@ public:
namespace
Experimental
{
namespace
Experimental
{
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
/// A
f
uture class. It can wrap an std::future.
/// A
TF
uture class. It can wrap an std::future.
template
<
typename
T
>
template
<
typename
T
>
class
Future
final
:
public
ROOT
::
Detail
::
FutureImpl
<
T
>
{
class
T
Future
final
:
public
ROOT
::
Detail
::
T
FutureImpl
<
T
>
{
template
<
class
Function
,
class
...
Args
>
template
<
class
Function
,
class
...
Args
>
friend
Future
<
typename
std
::
result_of
<
typename
std
::
decay
<
Function
>::
type
(
typename
std
::
decay
<
Args
>::
type
...)
>::
type
>
Async
(
Function
&&
f
,
Args
&&
...
args
);
friend
T
Future
<
typename
std
::
result_of
<
typename
std
::
decay
<
Function
>::
type
(
typename
std
::
decay
<
Args
>::
type
...)
>::
type
>
Async
(
Function
&&
f
,
Args
&&
...
args
);
private:
private:
Future
(
std
::
future
<
T
>
&&
fut
,
std
::
unique_ptr
<
TTaskGroup
>
&&
tg
)
T
Future
(
std
::
future
<
T
>
&&
fut
,
std
::
unique_ptr
<
TTaskGroup
>
&&
tg
)
:
ROOT
::
Detail
::
FutureImpl
<
T
>
(
std
::
forward
<
std
::
future
<
T
>>
(
fut
),
std
::
move
(
tg
)){};
:
ROOT
::
Detail
::
T
FutureImpl
<
T
>
(
std
::
forward
<
std
::
future
<
T
>>
(
fut
),
std
::
move
(
tg
)){};
public
:
public
:
Future
(
std
::
future
<
T
>
&&
fut
)
:
ROOT
::
Detail
::
FutureImpl
<
T
>
(
std
::
forward
<
std
::
future
<
T
>>
(
fut
))
{};
T
Future
(
std
::
future
<
T
>
&&
fut
)
:
ROOT
::
Detail
::
T
FutureImpl
<
T
>
(
std
::
forward
<
std
::
future
<
T
>>
(
fut
))
{};
T
get
()
T
get
()
{
{
...
@@ -95,14 +95,14 @@ public:
...
@@ -95,14 +95,14 @@ public:
/// \cond
/// \cond
// Two specialisations, for void and T& as for std::future
// Two specialisations, for void and T& as for std::future
template
<
>
template
<
>
class
Future
<
void
>
final
:
public
ROOT
::
Detail
::
FutureImpl
<
void
>
{
class
T
Future
<
void
>
final
:
public
ROOT
::
Detail
::
T
FutureImpl
<
void
>
{
template
<
class
Function
,
class
...
Args
>
template
<
class
Function
,
class
...
Args
>
friend
Future
<
typename
std
::
result_of
<
typename
std
::
decay
<
Function
>::
type
(
typename
std
::
decay
<
Args
>::
type
...)
>::
type
>
Async
(
Function
&&
f
,
Args
&&
...
args
);
friend
T
Future
<
typename
std
::
result_of
<
typename
std
::
decay
<
Function
>::
type
(
typename
std
::
decay
<
Args
>::
type
...)
>::
type
>
Async
(
Function
&&
f
,
Args
&&
...
args
);
private:
private:
Future
(
std
::
future
<
void
>
&&
fut
,
std
::
unique_ptr
<
TTaskGroup
>
&&
tg
)
T
Future
(
std
::
future
<
void
>
&&
fut
,
std
::
unique_ptr
<
TTaskGroup
>
&&
tg
)
:
ROOT
::
Detail
::
FutureImpl
<
void
>
(
std
::
forward
<
std
::
future
<
void
>>
(
fut
),
std
::
move
(
tg
)){};
:
ROOT
::
Detail
::
T
FutureImpl
<
void
>
(
std
::
forward
<
std
::
future
<
void
>>
(
fut
),
std
::
move
(
tg
)){};
public
:
public
:
Future
(
std
::
future
<
void
>
&&
fut
)
:
ROOT
::
Detail
::
FutureImpl
<
void
>
(
std
::
forward
<
std
::
future
<
void
>>
(
fut
))
{};
T
Future
(
std
::
future
<
void
>
&&
fut
)
:
ROOT
::
Detail
::
T
FutureImpl
<
void
>
(
std
::
forward
<
std
::
future
<
void
>>
(
fut
))
{};
void
get
()
void
get
()
{
{
...
@@ -112,14 +112,14 @@ public:
...
@@ -112,14 +112,14 @@ public:
};
};
template
<
typename
T
>
template
<
typename
T
>
class
Future
<
T
&>
final
:
public
ROOT
::
Detail
::
FutureImpl
<
T
&>
{
class
T
Future
<
T
&>
final
:
public
ROOT
::
Detail
::
T
FutureImpl
<
T
&>
{
template
<
class
Function
,
class
...
Args
>
template
<
class
Function
,
class
...
Args
>
friend
Future
<
typename
std
::
result_of
<
typename
std
::
decay
<
Function
>::
type
(
typename
std
::
decay
<
Args
>::
type
...)
>::
type
>
Async
(
Function
&&
f
,
Args
&&
...
args
);
friend
T
Future
<
typename
std
::
result_of
<
typename
std
::
decay
<
Function
>::
type
(
typename
std
::
decay
<
Args
>::
type
...)
>::
type
>
Async
(
Function
&&
f
,
Args
&&
...
args
);
private:
private:
Future
(
std
::
future
<
T
&>
&&
fut
,
std
::
unique_ptr
<
TTaskGroup
>
&&
tg
)
T
Future
(
std
::
future
<
T
&>
&&
fut
,
std
::
unique_ptr
<
TTaskGroup
>
&&
tg
)
:
ROOT
::
Detail
::
FutureImpl
<
T
&>
(
std
::
forward
<
std
::
future
<
T
&>>
(
fut
),
std
::
move
(
tg
)){};
:
ROOT
::
Detail
::
T
FutureImpl
<
T
&>
(
std
::
forward
<
std
::
future
<
T
&>>
(
fut
),
std
::
move
(
tg
)){};
public
:
public
:
Future
(
std
::
future
<
T
&>
&&
fut
)
:
ROOT
::
Detail
::
FutureImpl
<
T
&>
(
std
::
forward
<
std
::
future
<
T
&>>
(
fut
))
{};
T
Future
(
std
::
future
<
T
&>
&&
fut
)
:
ROOT
::
Detail
::
T
FutureImpl
<
T
&>
(
std
::
forward
<
std
::
future
<
T
&>>
(
fut
))
{};
T
&
get
()
T
&
get
()
{
{
...
@@ -131,9 +131,9 @@ public:
...
@@ -131,9 +131,9 @@ public:
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
/// Runs a function asynchronously potentially in a new thread and returns a
/// Runs a function asynchronously potentially in a new thread and returns a
/// ROOT Future that will hold the result.
/// ROOT
T
Future that will hold the result.
template
<
class
Function
,
class
...
Args
>
template
<
class
Function
,
class
...
Args
>
Future
<
typename
std
::
result_of
<
typename
std
::
decay
<
Function
>::
type
(
typename
std
::
decay
<
Args
>::
type
...)
>::
type
>
T
Future
<
typename
std
::
result_of
<
typename
std
::
decay
<
Function
>::
type
(
typename
std
::
decay
<
Args
>::
type
...)
>::
type
>
Async
(
Function
&&
f
,
Args
&&
...
args
)
Async
(
Function
&&
f
,
Args
&&
...
args
)
{
{
// The return type according to the standard implementation of std::future
// The return type according to the standard implementation of std::future
...
@@ -146,7 +146,7 @@ Async(Function &&f, Args &&... args)
...
@@ -146,7 +146,7 @@ Async(Function &&f, Args &&... args)
std
::
unique_ptr
<
ROOT
::
Experimental
::
TTaskGroup
>
tg
(
new
ROOT
::
Experimental
::
TTaskGroup
());
std
::
unique_ptr
<
ROOT
::
Experimental
::
TTaskGroup
>
tg
(
new
ROOT
::
Experimental
::
TTaskGroup
());
tg
->
Run
([
thisPt
]()
{
(
*
thisPt
)();
});
tg
->
Run
([
thisPt
]()
{
(
*
thisPt
)();
});
return
ROOT
::
Experimental
::
Future
<
Ret_t
>
(
thisPt
->
get_future
(),
std
::
move
(
tg
));
return
ROOT
::
Experimental
::
T
Future
<
Ret_t
>
(
thisPt
->
get_future
(),
std
::
move
(
tg
));
}
}
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment