How do you print to console in a Multi-Threaded MEX Function?
I'm writing a simple producer consumer MEX function which uses the Boost library. I have manged to get the following program to work without any issues.
#include "mex.h"
#include <boost/thread/thread.hpp>
#include <boost/lockfree/spsc_queue.hpp>
#include <iostream>
#include <boost/atomic.hpp>
int producer_count = 0;
boost::atomic_int consumer_count (0);
boost::lockfree::spsc_queue<int, boost::lockfree::capacity<1024> > spsc_queue;
const int iterations = 10000000;
void producer()
{
for (int i = 0; i != iterations; ++i) {
int value = ++producer_count;
while (!spsc_queue.push(value));
}
}
boost::atomic<bool> done (false);
void consumer()
{
int value;
while (!done) {
while (spsc_queue.pop(value))
++consumer_count;
}
while (spsc_queue.pop(value))
++consumer_count;
}
void mexFunction(int nlhs, mxArray *plhs, int nrhs, const mxArray *prhs)
{
if (!spsc_queue.is_lock_free())
{
mexPrintf("boost::lockfree::queue is not lockfreen");
mexEvalString("drawnow;");
}
else
{
mexPrintf("boost::lockfree::queue is lockfreen");
mexEvalString("drawnow;");
}
boost::thread producer_thread(producer);
boost::thread consumer_thread(consumer);
producer_thread.join();
done = true;
consumer_thread.join();
cout << "produced " << producer_count << " objects." << endl;
cout << "consumed " << consumer_count << " objects." << endl;
}
The big problem is I try to include a mexPrintf()
into the either the producer or consumer method MATLAB just crashes. After doing some investigation I found this post which explained this happens because of race conditions. Does anyone know how I can fix this issue? I read what the answer said about Mutex, but I do not understand how I would implement such a functionality.
c++ multithreading matlab boost mex
add a comment |
I'm writing a simple producer consumer MEX function which uses the Boost library. I have manged to get the following program to work without any issues.
#include "mex.h"
#include <boost/thread/thread.hpp>
#include <boost/lockfree/spsc_queue.hpp>
#include <iostream>
#include <boost/atomic.hpp>
int producer_count = 0;
boost::atomic_int consumer_count (0);
boost::lockfree::spsc_queue<int, boost::lockfree::capacity<1024> > spsc_queue;
const int iterations = 10000000;
void producer()
{
for (int i = 0; i != iterations; ++i) {
int value = ++producer_count;
while (!spsc_queue.push(value));
}
}
boost::atomic<bool> done (false);
void consumer()
{
int value;
while (!done) {
while (spsc_queue.pop(value))
++consumer_count;
}
while (spsc_queue.pop(value))
++consumer_count;
}
void mexFunction(int nlhs, mxArray *plhs, int nrhs, const mxArray *prhs)
{
if (!spsc_queue.is_lock_free())
{
mexPrintf("boost::lockfree::queue is not lockfreen");
mexEvalString("drawnow;");
}
else
{
mexPrintf("boost::lockfree::queue is lockfreen");
mexEvalString("drawnow;");
}
boost::thread producer_thread(producer);
boost::thread consumer_thread(consumer);
producer_thread.join();
done = true;
consumer_thread.join();
cout << "produced " << producer_count << " objects." << endl;
cout << "consumed " << consumer_count << " objects." << endl;
}
The big problem is I try to include a mexPrintf()
into the either the producer or consumer method MATLAB just crashes. After doing some investigation I found this post which explained this happens because of race conditions. Does anyone know how I can fix this issue? I read what the answer said about Mutex, but I do not understand how I would implement such a functionality.
c++ multithreading matlab boost mex
add a comment |
I'm writing a simple producer consumer MEX function which uses the Boost library. I have manged to get the following program to work without any issues.
#include "mex.h"
#include <boost/thread/thread.hpp>
#include <boost/lockfree/spsc_queue.hpp>
#include <iostream>
#include <boost/atomic.hpp>
int producer_count = 0;
boost::atomic_int consumer_count (0);
boost::lockfree::spsc_queue<int, boost::lockfree::capacity<1024> > spsc_queue;
const int iterations = 10000000;
void producer()
{
for (int i = 0; i != iterations; ++i) {
int value = ++producer_count;
while (!spsc_queue.push(value));
}
}
boost::atomic<bool> done (false);
void consumer()
{
int value;
while (!done) {
while (spsc_queue.pop(value))
++consumer_count;
}
while (spsc_queue.pop(value))
++consumer_count;
}
void mexFunction(int nlhs, mxArray *plhs, int nrhs, const mxArray *prhs)
{
if (!spsc_queue.is_lock_free())
{
mexPrintf("boost::lockfree::queue is not lockfreen");
mexEvalString("drawnow;");
}
else
{
mexPrintf("boost::lockfree::queue is lockfreen");
mexEvalString("drawnow;");
}
boost::thread producer_thread(producer);
boost::thread consumer_thread(consumer);
producer_thread.join();
done = true;
consumer_thread.join();
cout << "produced " << producer_count << " objects." << endl;
cout << "consumed " << consumer_count << " objects." << endl;
}
The big problem is I try to include a mexPrintf()
into the either the producer or consumer method MATLAB just crashes. After doing some investigation I found this post which explained this happens because of race conditions. Does anyone know how I can fix this issue? I read what the answer said about Mutex, but I do not understand how I would implement such a functionality.
c++ multithreading matlab boost mex
I'm writing a simple producer consumer MEX function which uses the Boost library. I have manged to get the following program to work without any issues.
#include "mex.h"
#include <boost/thread/thread.hpp>
#include <boost/lockfree/spsc_queue.hpp>
#include <iostream>
#include <boost/atomic.hpp>
int producer_count = 0;
boost::atomic_int consumer_count (0);
boost::lockfree::spsc_queue<int, boost::lockfree::capacity<1024> > spsc_queue;
const int iterations = 10000000;
void producer()
{
for (int i = 0; i != iterations; ++i) {
int value = ++producer_count;
while (!spsc_queue.push(value));
}
}
boost::atomic<bool> done (false);
void consumer()
{
int value;
while (!done) {
while (spsc_queue.pop(value))
++consumer_count;
}
while (spsc_queue.pop(value))
++consumer_count;
}
void mexFunction(int nlhs, mxArray *plhs, int nrhs, const mxArray *prhs)
{
if (!spsc_queue.is_lock_free())
{
mexPrintf("boost::lockfree::queue is not lockfreen");
mexEvalString("drawnow;");
}
else
{
mexPrintf("boost::lockfree::queue is lockfreen");
mexEvalString("drawnow;");
}
boost::thread producer_thread(producer);
boost::thread consumer_thread(consumer);
producer_thread.join();
done = true;
consumer_thread.join();
cout << "produced " << producer_count << " objects." << endl;
cout << "consumed " << consumer_count << " objects." << endl;
}
The big problem is I try to include a mexPrintf()
into the either the producer or consumer method MATLAB just crashes. After doing some investigation I found this post which explained this happens because of race conditions. Does anyone know how I can fix this issue? I read what the answer said about Mutex, but I do not understand how I would implement such a functionality.
c++ multithreading matlab boost mex
c++ multithreading matlab boost mex
edited Jan 2 at 18:41


Cris Luengo
22.3k52253
22.3k52253
asked Jan 2 at 17:49
Crystal PritzkerCrystal Pritzker
168210
168210
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
You cannot call mexPrintf
from any thread except the main thread. A mutex will not solve your problem.
From the MATLAB documentation:
MEX API Is Not Thread Safe
Do not call a single session of MATLAB® on separate threads from a MEX file. The MEX and Matrix Library APIs are not multi-threaded.
You can create threads from a C MEX file; however, accessing MATLAB from those threads is not supported. Do not call any MEX API functions from the spawned threads, including
printf
, which is defined asmexPrintf
in themex.h
header file.
If you really need to produce output from these threads, consider implementing a simple messaging system where the threads post a message with the text to be output, and the main thread, instead of waiting with producer_thread.join();
, sits in a loop looking for messages to print, and prints them with mexPrintf
.
The code below is not tested. It's not even been compiled. Consider it pseudo-code. I think this is a reasonable attempt at a solution but there might be much better approaches. Continue at your own risk. :)
boost::lockfree::queue<std::string> message_queue;
void producer() {
//...
message_queue.push("A string to print!");
//...
}
void mexFunction( /*...*/ ) {
// ...
boost::thread producer_thread(producer);
boost::thread consumer_thread(consumer);
while(producer_thread.joinable()) {
join_for(boost::chrono::milliseconds(50));
std::string s;
while (message_queue.pop(s)) {
mexPrintf("%sn", s.c_str());
}
}
producer_thread.join();
done = true;
consumer_thread.join();
// ...
}
Thanks for explaining why it's not possible. Could you expand on you explanation of how I could implement a messaging system? Some example code would really be appreciated.
– Crystal Pritzker
Jan 2 at 18:20
@CrystalPritzker: Sorry, I have little experience with that, I'm afraid I'd recommend something that's wrong. I imagine you'd do, in main, awhile(joinable())
loop, with ajoin_for(boost::chrono::milliseconds(50))
wait inside. Then you'd have a linked list of messages, which you'd print and remove from the list within this loop. The worker threads would append to the list. The list would be protected by astd::mutex
for multi-threaded access (or useboost::lockfree::queue
instead, which has the mutex built in). But this is my low-experience guess at a solution.
– Cris Luengo
Jan 2 at 18:34
@CrystalPritzker: I've added a bit of code, for how I thought about this solution. I'm not sure even if it would compile... :)
– Cris Luengo
Jan 2 at 18:42
I appreciate the help. Thank you very much!
– Crystal Pritzker
Jan 2 at 18:45
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54010898%2fhow-do-you-print-to-console-in-a-multi-threaded-mex-function%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You cannot call mexPrintf
from any thread except the main thread. A mutex will not solve your problem.
From the MATLAB documentation:
MEX API Is Not Thread Safe
Do not call a single session of MATLAB® on separate threads from a MEX file. The MEX and Matrix Library APIs are not multi-threaded.
You can create threads from a C MEX file; however, accessing MATLAB from those threads is not supported. Do not call any MEX API functions from the spawned threads, including
printf
, which is defined asmexPrintf
in themex.h
header file.
If you really need to produce output from these threads, consider implementing a simple messaging system where the threads post a message with the text to be output, and the main thread, instead of waiting with producer_thread.join();
, sits in a loop looking for messages to print, and prints them with mexPrintf
.
The code below is not tested. It's not even been compiled. Consider it pseudo-code. I think this is a reasonable attempt at a solution but there might be much better approaches. Continue at your own risk. :)
boost::lockfree::queue<std::string> message_queue;
void producer() {
//...
message_queue.push("A string to print!");
//...
}
void mexFunction( /*...*/ ) {
// ...
boost::thread producer_thread(producer);
boost::thread consumer_thread(consumer);
while(producer_thread.joinable()) {
join_for(boost::chrono::milliseconds(50));
std::string s;
while (message_queue.pop(s)) {
mexPrintf("%sn", s.c_str());
}
}
producer_thread.join();
done = true;
consumer_thread.join();
// ...
}
Thanks for explaining why it's not possible. Could you expand on you explanation of how I could implement a messaging system? Some example code would really be appreciated.
– Crystal Pritzker
Jan 2 at 18:20
@CrystalPritzker: Sorry, I have little experience with that, I'm afraid I'd recommend something that's wrong. I imagine you'd do, in main, awhile(joinable())
loop, with ajoin_for(boost::chrono::milliseconds(50))
wait inside. Then you'd have a linked list of messages, which you'd print and remove from the list within this loop. The worker threads would append to the list. The list would be protected by astd::mutex
for multi-threaded access (or useboost::lockfree::queue
instead, which has the mutex built in). But this is my low-experience guess at a solution.
– Cris Luengo
Jan 2 at 18:34
@CrystalPritzker: I've added a bit of code, for how I thought about this solution. I'm not sure even if it would compile... :)
– Cris Luengo
Jan 2 at 18:42
I appreciate the help. Thank you very much!
– Crystal Pritzker
Jan 2 at 18:45
add a comment |
You cannot call mexPrintf
from any thread except the main thread. A mutex will not solve your problem.
From the MATLAB documentation:
MEX API Is Not Thread Safe
Do not call a single session of MATLAB® on separate threads from a MEX file. The MEX and Matrix Library APIs are not multi-threaded.
You can create threads from a C MEX file; however, accessing MATLAB from those threads is not supported. Do not call any MEX API functions from the spawned threads, including
printf
, which is defined asmexPrintf
in themex.h
header file.
If you really need to produce output from these threads, consider implementing a simple messaging system where the threads post a message with the text to be output, and the main thread, instead of waiting with producer_thread.join();
, sits in a loop looking for messages to print, and prints them with mexPrintf
.
The code below is not tested. It's not even been compiled. Consider it pseudo-code. I think this is a reasonable attempt at a solution but there might be much better approaches. Continue at your own risk. :)
boost::lockfree::queue<std::string> message_queue;
void producer() {
//...
message_queue.push("A string to print!");
//...
}
void mexFunction( /*...*/ ) {
// ...
boost::thread producer_thread(producer);
boost::thread consumer_thread(consumer);
while(producer_thread.joinable()) {
join_for(boost::chrono::milliseconds(50));
std::string s;
while (message_queue.pop(s)) {
mexPrintf("%sn", s.c_str());
}
}
producer_thread.join();
done = true;
consumer_thread.join();
// ...
}
Thanks for explaining why it's not possible. Could you expand on you explanation of how I could implement a messaging system? Some example code would really be appreciated.
– Crystal Pritzker
Jan 2 at 18:20
@CrystalPritzker: Sorry, I have little experience with that, I'm afraid I'd recommend something that's wrong. I imagine you'd do, in main, awhile(joinable())
loop, with ajoin_for(boost::chrono::milliseconds(50))
wait inside. Then you'd have a linked list of messages, which you'd print and remove from the list within this loop. The worker threads would append to the list. The list would be protected by astd::mutex
for multi-threaded access (or useboost::lockfree::queue
instead, which has the mutex built in). But this is my low-experience guess at a solution.
– Cris Luengo
Jan 2 at 18:34
@CrystalPritzker: I've added a bit of code, for how I thought about this solution. I'm not sure even if it would compile... :)
– Cris Luengo
Jan 2 at 18:42
I appreciate the help. Thank you very much!
– Crystal Pritzker
Jan 2 at 18:45
add a comment |
You cannot call mexPrintf
from any thread except the main thread. A mutex will not solve your problem.
From the MATLAB documentation:
MEX API Is Not Thread Safe
Do not call a single session of MATLAB® on separate threads from a MEX file. The MEX and Matrix Library APIs are not multi-threaded.
You can create threads from a C MEX file; however, accessing MATLAB from those threads is not supported. Do not call any MEX API functions from the spawned threads, including
printf
, which is defined asmexPrintf
in themex.h
header file.
If you really need to produce output from these threads, consider implementing a simple messaging system where the threads post a message with the text to be output, and the main thread, instead of waiting with producer_thread.join();
, sits in a loop looking for messages to print, and prints them with mexPrintf
.
The code below is not tested. It's not even been compiled. Consider it pseudo-code. I think this is a reasonable attempt at a solution but there might be much better approaches. Continue at your own risk. :)
boost::lockfree::queue<std::string> message_queue;
void producer() {
//...
message_queue.push("A string to print!");
//...
}
void mexFunction( /*...*/ ) {
// ...
boost::thread producer_thread(producer);
boost::thread consumer_thread(consumer);
while(producer_thread.joinable()) {
join_for(boost::chrono::milliseconds(50));
std::string s;
while (message_queue.pop(s)) {
mexPrintf("%sn", s.c_str());
}
}
producer_thread.join();
done = true;
consumer_thread.join();
// ...
}
You cannot call mexPrintf
from any thread except the main thread. A mutex will not solve your problem.
From the MATLAB documentation:
MEX API Is Not Thread Safe
Do not call a single session of MATLAB® on separate threads from a MEX file. The MEX and Matrix Library APIs are not multi-threaded.
You can create threads from a C MEX file; however, accessing MATLAB from those threads is not supported. Do not call any MEX API functions from the spawned threads, including
printf
, which is defined asmexPrintf
in themex.h
header file.
If you really need to produce output from these threads, consider implementing a simple messaging system where the threads post a message with the text to be output, and the main thread, instead of waiting with producer_thread.join();
, sits in a loop looking for messages to print, and prints them with mexPrintf
.
The code below is not tested. It's not even been compiled. Consider it pseudo-code. I think this is a reasonable attempt at a solution but there might be much better approaches. Continue at your own risk. :)
boost::lockfree::queue<std::string> message_queue;
void producer() {
//...
message_queue.push("A string to print!");
//...
}
void mexFunction( /*...*/ ) {
// ...
boost::thread producer_thread(producer);
boost::thread consumer_thread(consumer);
while(producer_thread.joinable()) {
join_for(boost::chrono::milliseconds(50));
std::string s;
while (message_queue.pop(s)) {
mexPrintf("%sn", s.c_str());
}
}
producer_thread.join();
done = true;
consumer_thread.join();
// ...
}
edited Jan 2 at 18:40
answered Jan 2 at 18:02


Cris LuengoCris Luengo
22.3k52253
22.3k52253
Thanks for explaining why it's not possible. Could you expand on you explanation of how I could implement a messaging system? Some example code would really be appreciated.
– Crystal Pritzker
Jan 2 at 18:20
@CrystalPritzker: Sorry, I have little experience with that, I'm afraid I'd recommend something that's wrong. I imagine you'd do, in main, awhile(joinable())
loop, with ajoin_for(boost::chrono::milliseconds(50))
wait inside. Then you'd have a linked list of messages, which you'd print and remove from the list within this loop. The worker threads would append to the list. The list would be protected by astd::mutex
for multi-threaded access (or useboost::lockfree::queue
instead, which has the mutex built in). But this is my low-experience guess at a solution.
– Cris Luengo
Jan 2 at 18:34
@CrystalPritzker: I've added a bit of code, for how I thought about this solution. I'm not sure even if it would compile... :)
– Cris Luengo
Jan 2 at 18:42
I appreciate the help. Thank you very much!
– Crystal Pritzker
Jan 2 at 18:45
add a comment |
Thanks for explaining why it's not possible. Could you expand on you explanation of how I could implement a messaging system? Some example code would really be appreciated.
– Crystal Pritzker
Jan 2 at 18:20
@CrystalPritzker: Sorry, I have little experience with that, I'm afraid I'd recommend something that's wrong. I imagine you'd do, in main, awhile(joinable())
loop, with ajoin_for(boost::chrono::milliseconds(50))
wait inside. Then you'd have a linked list of messages, which you'd print and remove from the list within this loop. The worker threads would append to the list. The list would be protected by astd::mutex
for multi-threaded access (or useboost::lockfree::queue
instead, which has the mutex built in). But this is my low-experience guess at a solution.
– Cris Luengo
Jan 2 at 18:34
@CrystalPritzker: I've added a bit of code, for how I thought about this solution. I'm not sure even if it would compile... :)
– Cris Luengo
Jan 2 at 18:42
I appreciate the help. Thank you very much!
– Crystal Pritzker
Jan 2 at 18:45
Thanks for explaining why it's not possible. Could you expand on you explanation of how I could implement a messaging system? Some example code would really be appreciated.
– Crystal Pritzker
Jan 2 at 18:20
Thanks for explaining why it's not possible. Could you expand on you explanation of how I could implement a messaging system? Some example code would really be appreciated.
– Crystal Pritzker
Jan 2 at 18:20
@CrystalPritzker: Sorry, I have little experience with that, I'm afraid I'd recommend something that's wrong. I imagine you'd do, in main, a
while(joinable())
loop, with a join_for(boost::chrono::milliseconds(50))
wait inside. Then you'd have a linked list of messages, which you'd print and remove from the list within this loop. The worker threads would append to the list. The list would be protected by a std::mutex
for multi-threaded access (or use boost::lockfree::queue
instead, which has the mutex built in). But this is my low-experience guess at a solution.– Cris Luengo
Jan 2 at 18:34
@CrystalPritzker: Sorry, I have little experience with that, I'm afraid I'd recommend something that's wrong. I imagine you'd do, in main, a
while(joinable())
loop, with a join_for(boost::chrono::milliseconds(50))
wait inside. Then you'd have a linked list of messages, which you'd print and remove from the list within this loop. The worker threads would append to the list. The list would be protected by a std::mutex
for multi-threaded access (or use boost::lockfree::queue
instead, which has the mutex built in). But this is my low-experience guess at a solution.– Cris Luengo
Jan 2 at 18:34
@CrystalPritzker: I've added a bit of code, for how I thought about this solution. I'm not sure even if it would compile... :)
– Cris Luengo
Jan 2 at 18:42
@CrystalPritzker: I've added a bit of code, for how I thought about this solution. I'm not sure even if it would compile... :)
– Cris Luengo
Jan 2 at 18:42
I appreciate the help. Thank you very much!
– Crystal Pritzker
Jan 2 at 18:45
I appreciate the help. Thank you very much!
– Crystal Pritzker
Jan 2 at 18:45
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54010898%2fhow-do-you-print-to-console-in-a-multi-threaded-mex-function%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown