Ignore:
Timestamp:
Feb 18, 2025, 12:54:23 PM (6 weeks ago)
Author:
Andrew Beach <ajbeach@…>
Branches:
master
Children:
8705a11
Parents:
3e5fea2
Message:

Clean-up the warnings of the concurrency tests. A lot of little test level fixes, the most interesting repeated one is some formally redundent fallthough statements. pthread_attr_test had to be rewritten because of library restrictions. Changed some types so they would always be pointer sized. There was a library change, there was a function that could not be implemented; I trust that it is included for a reason so I just put it in a comment. There is a change to the compiler, wait-until now uses goto. The labelled breaks were code generated as unlabelled breaks and although it worked out slipped through some checks. Finally, there is one warning that I cannot solve at this time so tests that produce it have been put in their own lax group.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified tests/concurrency/pthread/pthread_demo_create_join.cfa

    r3e5fea2 rd923fca  
    33/* test pthread create/join/exit */
    44
    5 int arr[20];
     5size_t arr[20];
    66
    77void* fetch(void* idx){
    8     int res = arr[(uint64_t)idx];
     8    size_t res = arr[(size_t)idx];
    99    pthread_exit((void*)res);
    1010    sout | "it should not be here";
     
    1919}
    2020
    21 int main(int argc, char const *argv[])
     21int main()
    2222{
    2323    pthread_t threads[20];
    2424    arr_init();
    2525    int status;
    26     for (int i = 0; i < 20; i++){
     26    for (size_t i = 0; i < 20; i++){
    2727        status = pthread_create(&threads[i], NULL, fetch, (void*)i);
    2828        if (status != 0) exit(1);
     
    3030    int res = 0;
    3131    for (int i = 0; i < 20; i++){
    32         void* _res = NULL;
    33         status = pthread_join(threads[i], &_res);
     32        void* res_i = NULL;
     33        status = pthread_join(threads[i], &res_i);
    3434        if (status != 0) exit(2);
    35         if (((uint64_t)_res) != i) exit(3);
    36         res += (uint64_t)_res;
     35        if (((size_t)res_i) != i) exit(3);
     36        res += (size_t)res_i;
    3737    }
    3838    sout | "final res is" | res;
Note: See TracChangeset for help on using the changeset viewer.