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

Found Error in Thread Handling #13

Open
Xnoopeex opened this issue Apr 10, 2024 · 1 comment
Open

Found Error in Thread Handling #13

Xnoopeex opened this issue Apr 10, 2024 · 1 comment

Comments

@Xnoopeex
Copy link

Xnoopeex commented Apr 10, 2024

Hi Gremsy team,

I found an issue with thread locking:.
gSDK Alpha:
gimbal_interface.cpp

Gimbal_Interface::imu_t Gimbal_Interface::get_gimbal_raw_imu(void)
{
    pthread_mutex_lock(&_messages.mutex);

    /* Check gimbal imu value has changed*/
    if (_messages.timestamps.raw_imu) {
        /* Reset timestamps */
        _messages.timestamps.raw_imu = 0;
        const mavlink_raw_imu_t &raw = _messages.raw_imu;
        pthread_mutex_unlock(&_messages.mutex); //this needs to be added!
        return imu_t(vector3<int16_t>(raw.xacc, raw.yacc, raw.zacc), vector3<int16_t>(raw.xgyro, raw.ygyro, raw.zgyro));
    }

    pthread_mutex_unlock(&_messages.mutex);
    return imu_t();
}

see comment:
pthread_mutex_unlock(&_messages.mutex); //this needs to be added!
Otherwise the Thread stays in lock mode and crashes the application.

@Xnoopeex Xnoopeex changed the title Error in Thread Handling Found Error in Thread Handling Apr 10, 2024
@DatNguyenGremsy
Copy link

Thank you, we have fixed this error in the newest version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants