Welcome to the Linux Foundation Forum!

GDB singals waiting tasks when debugging my code

Hello,

I found out a problem when I run my code on linux on debug mode (it never happens when I run the exe file).

On my code I use few tasks. On the start of running my code I send all of them to wait, using the command: sem_wait.

Example:

while (rc==-1)

{

rc = sem_wait(&m_sem);

}

Eventhough, sometimes my tasks are waking up without any reason.

I did few searches, and I found out that the GDB signals my tasks and it is a known error.

The solution that people offered is the following code:

while (rc==-1)

{

rc = sem_wait(&m_sem);

if (rc==-1 && errno == EINTR)

{

continue;

}

else

{

break;

}

}

I am using Rhapsody 7.5.3 (for writing my code), and on Rhapsody's framework files I have the following code:

while (rc==-1)

{

rc = sem_wait(&m_sem);

#ifdef OM_SEMAPHORE_CAN_BE_INTERRUPTED

if (rc==-1 && errno == EINTR)

{

continue;

}

else

{

#endif

break;

}

}

Like you can see, compile my code with the OM_SEMAPHORE_CAN_BE_INTERRUPTED can solve the problem.

But, this is a lib file for me. Therefore, If I will change that flag for debug, it will be also changed when I execute my (as an exe file).

Do you think it can create another problem for me or is it ok?

Categories

Upcoming Training