Changeset de33dab in mainline for uspace/tester/thread/thread1.c


Ignore:
Timestamp:
2007-04-09T13:53:57Z (18 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
183788f1
Parents:
d0b1443
Message:

Revert some of the changes introduced in revision 2209.
I think it is not correct to remove serialization of pseudo threads in printf_core.c.
With thread-level futex serialization, several pseudo threads running in one thread could easily deadlock
the task.

Add a dedicated futex serialization to thread1.c test only.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/tester/thread/thread1.c

    rd0b1443 rde33dab  
    3434#include <stdio.h>
    3535#include <unistd.h>
     36#include <futex.h>
    3637#include "../tester.h"
    3738
     
    4041static bool sh_quiet;
    4142
     43static atomic_t srlz = FUTEX_INITIALIZER;
     44
    4245static void threadtest(void *data)
    4346{
     
    4548
    4649        while (atomic_get(&finish)) {
    47                 if (!sh_quiet)
     50                if (!sh_quiet) {
     51                        futex_down(&srlz);
    4852                        printf("%llu ", thread_get_id());
     53                        futex_up(&srlz);
     54                }
    4955                usleep(100000);
    5056        }
     
    6975        }
    7076       
    71         if (!quiet)
     77        if (!quiet) {
     78                futex_down(&srlz);
    7279                printf("Running threads for 10 seconds...\n");
     80                futex_up(&srlz);
     81        }
    7382        sleep(10);
    7483       
Note: See TracChangeset for help on using the changeset viewer.