[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug in DDD
From: |
Jorge Enrique Perez Martinez |
Subject: |
bug in DDD |
Date: |
Tue, 02 Nov 2004 17:43:01 +0100 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax) |
I have this program:
#define _REENTRANT
#include <assert.h>
#include <semaphore.h>
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <pthread.h>
static pthread_t t_cliente;
static sem_t s1;
void *cliente(void *basura) {
int r;
printf ("Comienza el cliente\n");
r = sem_wait (&s1);
printf ("Cliente pasa semaforo\n");
if (r != 0) printf("Valro devuelto por el sem wait = %d\n", r);
pthread_exit (NULL);
return NULL;
}
int main (int argc, char *argv[]) {
assert (sem_init (&s1, 0, 0) == 0);
assert (pthread_create(&t_cliente, NULL, cliente, NULL) == 0);
sleep (4);
assert (sem_post (&s1) == 0);
assert (pthread_join (t_cliente, NULL) == 0);
exit (0);
}
I compile this program with gcc and I execute it on a 64-bit computer.
The running operating system is Linux (kernel 2.6).
The execution is correct. However, with DDD (versions 3.3.8, 3.3.9 and
3.3.10) I set a breakpoint in the sentence
sem_wait of the client. I hit Run and then Next. The client goes through
the sem_wait sentence (incorrectly) returning
the value -1. On the other hand, if we are displaying the data structure
s1, the field sem_waiting always has the value 0x0.
How can I solve this problem?
Thanks in advance,
Jorge Enrique Pérez Martínez
Departamento de Informática Aplicada
Universidad Politécnica de Madrid. Spain
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- bug in DDD,
Jorge Enrique Perez Martinez <=