[BUG] event_wait_timed can't return false
I maintainer di solito rispondono entro 3 giorni
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 38/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- c
- Ambito
- operating-systems
Direzione di ricerca
Start in portable/ThirdParty/GCC/Posix/utils/wait_for_event.c, in event_wait_timed, and check what the return value of pthread_cond_timedwait is compared against on the timeout path; the reported symptom is that every reachable branch returns true. Build the reproducer from the issue against that file (gcc -D_GNU_SOURCE ... -pthread) and confirm the first assert fails, then confirm the mutex is released on timeout. Note that an open pull request, #1525, already targets this, so read it before writing anything.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Describe the bug
event_wait_timed returns true in all reachable branches.
Target
All targets using the portable/ThirdParty/GCC/Posix/utils/wait_for_event.c version of event_wait_timed.
Host
- Host OS: Fedora
- Version: 44
To Reproduce
Compile and run this on a Posix target. It will fail:
/* gcc -D_GNU_SOURCE t.c wait_for_event.c -pthread && ./a.out */
#include <assert.h>
#include <pthread.h>
#include <stdio.h>
#include <time.h>
#include <unistd.h>
#include "wait_for_event.h"
static void * sig( void * ev )
{
usleep( 50000 );
event_signal( ev );
return NULL;
}
int main( void )
{
struct event * ev = event_create();
pthread_t th;
/* Timeout must report false, and must not leak the mutex. */
assert( event_wait_timed( ev, 100 ) == false );
/* Object still usable after timeout; signal must report true. */
pthread_create( &th, NULL, sig, ev );
assert( event_wait_timed( ev, 5000 ) == true );
pthread_join( th, NULL );
event_delete( ev );
puts( "OK" );
}
Expected behavior
I'm expecting a false return in the first assert signalling a timeout but, even though it times out, the function returns true.
- Lingua principale
- C
- Stelle
- 4.6k
- Fork
- 1.6k
- Merge medio
- 2g 22h
- PR unite (30g)
- 4
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di FreeRTOS/FreeRTOS-Kernel
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
FreeRTOS/FreeRTOS-Kernel#1542 ·
I maintainer di solito rispondono entro 3 giorni
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
FreeRTOS/FreeRTOS-Kernel#1520 ·
I maintainer di solito rispondono entro 3 giorni
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
FreeRTOS/FreeRTOS-Kernel#1494 · 3 commenti ·
I maintainer di solito rispondono entro 3 giorni
-
enhancement
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
FreeRTOS/FreeRTOS-Kernel#1554 ·
I maintainer di solito rispondono entro 3 giorni
-
bug
Difficoltà 4/5 3-5 giorni Idoneità per principianti 22/100
FreeRTOS/FreeRTOS-Kernel#1545 ·
I maintainer di solito rispondono entro 3 giorni
Tutte le issue di FreeRTOS/FreeRTOS-Kernel
Issue simili
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
-
bug
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 63/100
FreeRTOS/FreeRTOS-Plus-TCP#1395 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
qoretechnologies/qore#8222 ·
I maintainer di solito rispondono entro 1 giorno
-
c easy first-contributor first-contributors good first issue help wanted up-for-grabs
Difficoltà 1/5 1-3 ore Idoneità per principianti 96/100
fork-commit-merge/fork-commit-merge#8696 ·
I maintainer di solito rispondono entro 1 giorno