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
- All Categories
- 178 LFX Mentorship
- 178 LFX Mentorship: Linux Kernel
- 774 Linux Foundation IT Professional Programs
- 383 Cloud Engineer IT Professional Program
- 175 Advanced Cloud Engineer IT Professional Program
- 75 DevOps IT Professional Program - Discontinued
- 7 DevOps & GitOps IT Professional Program
- 103 Cloud Native Developer IT Professional Program
- 7.6K Training Courses & Learning Paths
- 12 AI & ML Training
- 1 Blockchain & Decentralized Identity Training
- 32 Cloud & Containers Training
- 3 Cybersecurity Training
- 2 DevOps & Site-Reliability Training
- 1 Linux Kernel Development Training
- 2 Networking Training
- 2 Open Source Best Practice Training
- 5 System Administration Training
- 1 System Engineering Training
- 6 Web & Application Development Training
- 798 Hardware
- 202 Drivers
- 68 I/O Devices
- 37 Monitors
- 96 Multimedia
- 173 Networking
- 91 Printers & Scanners
- 92 Storage
- 772 Linux Distributions
- 81 Debian
- 68 Fedora
- 24 Linux Mint
- 13 Mageia
- 24 openSUSE
- 151 Red Hat Enterprise
- 31 Slackware
- 13 SUSE Enterprise
- 356 Ubuntu
- 469 Linux System Administration
- 31 Cloud Computing
- 73 Command Line/Scripting
- Github systems admin projects
- 101 Linux Security
- 79 Network Management
- 101 System Management
- 46 Web Management
- 165 Mobile Computing
- 32 Android
- 118 Development
- 1.2K New to Linux
- 1K Getting Started with Linux
- 406 Off Topic
- 128 Introductions
- 34 Study Material
- 1K Programming and Development
- 310 Kernel Development
- 719 Software Development
- 1K Software
- 418 Applications
- 182 Command Line
- 5 Compiling/Installing
- 71 Games
- 320 Installation
- Archived
- 183 Small Talk
- 2 LFD140 Class Forum
- 1.4K LFS258 Class Forum
Upcoming Training
-
August 20, 2018
Kubernetes Administration (LFS458)
-
August 20, 2018
Linux System Administration (LFS301)
-
August 27, 2018
Open Source Virtualization (LFS462)
-
August 27, 2018
Linux Kernel Debugging and Security (LFD440)