Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Add try/catch block around message queue recive method in the engine #600

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions src/vizdoom/src/viz_message_queue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,19 @@ void VIZ_MQSend(uint8_t code, const char * command){
}

void VIZ_MQReceive(void *msg) {
size_t size;
unsigned int priority;
if(vizMQDoom) {
size_t size;
unsigned int priority;

if(vizMQDoom) vizMQDoom->receive(msg, sizeof(VIZMessage), size, priority);
try{
vizMQDoom->receive(msg, sizeof(VIZMessage), size, priority);
}
catch(...){ // bip::interprocess_exception
VIZ_Error(VIZ_FUNC, "Failed to receive message.");
}

VIZ_DebugMsg(4, VIZ_FUNC, "Received msg: %d.", static_cast<VIZMessage *>(msg)->code);
VIZ_DebugMsg(4, VIZ_FUNC, "Received msg: %d.", static_cast<VIZMessage *>(msg)->code);
}
}

bool VIZ_MQTryReceive(void *msg){
Expand Down
Loading