What does “a single total order” mean in std::notify_one()? [duplicate]
This question already has an answer here:
Concurrency: Atomic and volatile in C++11 memory model
4 answers
How std::memory_order_seq_cst works
2 answers
I have read Concurrency: Atomic and volatile in C++11 memory model and How std::memory_order_seq_cst works, it doesn't help much and answer my question directly.
From https://en.cppreference.com/w/cpp/thread/condition_variable/notify_one:
The effects of
notify_one()
/notify_all()
and each of the three atomic
parts ofwait()
/wait_for()
/wait_until()
(unlock+wait, wakeup, and
lock) take place in a single total order that can be viewed as
modification order of an atomic variable: the order is specific to
this individual condition_variable. This makes it impossible for
notify_one()
to, for example, be delayed and unblock a thread that
started waiting just after the call tonotify_one()
was made.
What does it mean by saying "take place in a single total order"? How is this related to the next sentence "This makes it impossible ..... was made."? (It seems that it's telling a cause and effect).
I read it word by word more than 10 times and don't understand what it's saying.. Definition of "total order" from Wikipedia can't help much.
c++
marked as duplicate by SergeyA
StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 13 '18 at 17:13
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
add a comment |
This question already has an answer here:
Concurrency: Atomic and volatile in C++11 memory model
4 answers
How std::memory_order_seq_cst works
2 answers
I have read Concurrency: Atomic and volatile in C++11 memory model and How std::memory_order_seq_cst works, it doesn't help much and answer my question directly.
From https://en.cppreference.com/w/cpp/thread/condition_variable/notify_one:
The effects of
notify_one()
/notify_all()
and each of the three atomic
parts ofwait()
/wait_for()
/wait_until()
(unlock+wait, wakeup, and
lock) take place in a single total order that can be viewed as
modification order of an atomic variable: the order is specific to
this individual condition_variable. This makes it impossible for
notify_one()
to, for example, be delayed and unblock a thread that
started waiting just after the call tonotify_one()
was made.
What does it mean by saying "take place in a single total order"? How is this related to the next sentence "This makes it impossible ..... was made."? (It seems that it's telling a cause and effect).
I read it word by word more than 10 times and don't understand what it's saying.. Definition of "total order" from Wikipedia can't help much.
c++
marked as duplicate by SergeyA
StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 13 '18 at 17:13
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
I read the last sentence as: If one thread callednotify_one()
, then the thread which is woken up started it's waiting beforenotify_one()
was called. (It's impossible that a thread is considered which started waiting after.) At this point, there is granted a certain determinism, that normally isn't between threads (without any kind of locking/synchronization).
– Scheff
Nov 13 '18 at 17:13
1
Why is this duplicate ..? I took a glance at those two questions and did not find an direct answer.
– Rick
Nov 13 '18 at 17:18
add a comment |
This question already has an answer here:
Concurrency: Atomic and volatile in C++11 memory model
4 answers
How std::memory_order_seq_cst works
2 answers
I have read Concurrency: Atomic and volatile in C++11 memory model and How std::memory_order_seq_cst works, it doesn't help much and answer my question directly.
From https://en.cppreference.com/w/cpp/thread/condition_variable/notify_one:
The effects of
notify_one()
/notify_all()
and each of the three atomic
parts ofwait()
/wait_for()
/wait_until()
(unlock+wait, wakeup, and
lock) take place in a single total order that can be viewed as
modification order of an atomic variable: the order is specific to
this individual condition_variable. This makes it impossible for
notify_one()
to, for example, be delayed and unblock a thread that
started waiting just after the call tonotify_one()
was made.
What does it mean by saying "take place in a single total order"? How is this related to the next sentence "This makes it impossible ..... was made."? (It seems that it's telling a cause and effect).
I read it word by word more than 10 times and don't understand what it's saying.. Definition of "total order" from Wikipedia can't help much.
c++
This question already has an answer here:
Concurrency: Atomic and volatile in C++11 memory model
4 answers
How std::memory_order_seq_cst works
2 answers
I have read Concurrency: Atomic and volatile in C++11 memory model and How std::memory_order_seq_cst works, it doesn't help much and answer my question directly.
From https://en.cppreference.com/w/cpp/thread/condition_variable/notify_one:
The effects of
notify_one()
/notify_all()
and each of the three atomic
parts ofwait()
/wait_for()
/wait_until()
(unlock+wait, wakeup, and
lock) take place in a single total order that can be viewed as
modification order of an atomic variable: the order is specific to
this individual condition_variable. This makes it impossible for
notify_one()
to, for example, be delayed and unblock a thread that
started waiting just after the call tonotify_one()
was made.
What does it mean by saying "take place in a single total order"? How is this related to the next sentence "This makes it impossible ..... was made."? (It seems that it's telling a cause and effect).
I read it word by word more than 10 times and don't understand what it's saying.. Definition of "total order" from Wikipedia can't help much.
This question already has an answer here:
Concurrency: Atomic and volatile in C++11 memory model
4 answers
How std::memory_order_seq_cst works
2 answers
c++
c++
edited Nov 14 '18 at 2:15
Rick
asked Nov 13 '18 at 17:03
RickRick
1,563929
1,563929
marked as duplicate by SergeyA
StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 13 '18 at 17:13
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
marked as duplicate by SergeyA
StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 13 '18 at 17:13
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
I read the last sentence as: If one thread callednotify_one()
, then the thread which is woken up started it's waiting beforenotify_one()
was called. (It's impossible that a thread is considered which started waiting after.) At this point, there is granted a certain determinism, that normally isn't between threads (without any kind of locking/synchronization).
– Scheff
Nov 13 '18 at 17:13
1
Why is this duplicate ..? I took a glance at those two questions and did not find an direct answer.
– Rick
Nov 13 '18 at 17:18
add a comment |
I read the last sentence as: If one thread callednotify_one()
, then the thread which is woken up started it's waiting beforenotify_one()
was called. (It's impossible that a thread is considered which started waiting after.) At this point, there is granted a certain determinism, that normally isn't between threads (without any kind of locking/synchronization).
– Scheff
Nov 13 '18 at 17:13
1
Why is this duplicate ..? I took a glance at those two questions and did not find an direct answer.
– Rick
Nov 13 '18 at 17:18
I read the last sentence as: If one thread called
notify_one()
, then the thread which is woken up started it's waiting before notify_one()
was called. (It's impossible that a thread is considered which started waiting after.) At this point, there is granted a certain determinism, that normally isn't between threads (without any kind of locking/synchronization).– Scheff
Nov 13 '18 at 17:13
I read the last sentence as: If one thread called
notify_one()
, then the thread which is woken up started it's waiting before notify_one()
was called. (It's impossible that a thread is considered which started waiting after.) At this point, there is granted a certain determinism, that normally isn't between threads (without any kind of locking/synchronization).– Scheff
Nov 13 '18 at 17:13
1
1
Why is this duplicate ..? I took a glance at those two questions and did not find an direct answer.
– Rick
Nov 13 '18 at 17:18
Why is this duplicate ..? I took a glance at those two questions and did not find an direct answer.
– Rick
Nov 13 '18 at 17:18
add a comment |
0
active
oldest
votes
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
I read the last sentence as: If one thread called
notify_one()
, then the thread which is woken up started it's waiting beforenotify_one()
was called. (It's impossible that a thread is considered which started waiting after.) At this point, there is granted a certain determinism, that normally isn't between threads (without any kind of locking/synchronization).– Scheff
Nov 13 '18 at 17:13
1
Why is this duplicate ..? I took a glance at those two questions and did not find an direct answer.
– Rick
Nov 13 '18 at 17:18