[riot-notifications] [RIOT-OS/RIOT] pthread_cond.h: use 'sys/types.h' value of 'clockid_t' for avr. Enables pthread on AVR. (#12204)

Gaëtan Harter notifications at github.com
Wed Sep 11 18:36:25 CEST 2019


### Contribution description

This enables 'pthread' support on avr
    
avr-libc C90 'time.h' does not include 'sys/types.h' as POSIX expects it.
However, the type previously defined conflicts with the one in
'cpu/atmega_common/avr_libc_extra/include/sys/types.h' when both are
included, so include 'sys/types.h'.
    
Maybe it should alway be included by 'time.h' but this would need its specific review.

### Testing procedure

Run the `pthread*` tests on `avr` boards.

I could run all the tests on `arduino-mega2560`.

(except the disabled 'pthread_cooperation' that rashes due to lack of ram (and does not check the pthread_create return value))

```
./dist/tools/compile_and_test_for_board/compile_and_test_for_board.py . arduino-mega2560 --applications="tests/pthread  tests/pthread_barrier  tests/pthread_cleanup  tests/pthread_condition_variable  tests/pthread_cooperation  tests/pthread_flood  tests/pthread_rwlock
tests/pthread_tls"
INFO:arduino-mega2560:Saving toolchain
INFO:arduino-mega2560.tests/pthread:Board supported: True
INFO:arduino-mega2560.tests/pthread:Board has enough memory: True
INFO:arduino-mega2560.tests/pthread:Application has test: True
INFO:arduino-mega2560.tests/pthread:Run compilation
INFO:arduino-mega2560.tests/pthread:Run test
INFO:arduino-mega2560.tests/pthread:Run test.flash
INFO:arduino-mega2560.tests/pthread:Success
INFO:arduino-mega2560.tests/pthread_barrier:Board supported: True
INFO:arduino-mega2560.tests/pthread_barrier:Board has enough memory: True
INFO:arduino-mega2560.tests/pthread_barrier:Application has test: True
INFO:arduino-mega2560.tests/pthread_barrier:Run compilation
INFO:arduino-mega2560.tests/pthread_barrier:Run test
INFO:arduino-mega2560.tests/pthread_barrier:Run test.flash
INFO:arduino-mega2560.tests/pthread_barrier:Success
INFO:arduino-mega2560.tests/pthread_cleanup:Board supported: True
INFO:arduino-mega2560.tests/pthread_cleanup:Board has enough memory: True
INFO:arduino-mega2560.tests/pthread_cleanup:Application has test: True
INFO:arduino-mega2560.tests/pthread_cleanup:Run compilation
INFO:arduino-mega2560.tests/pthread_cleanup:Run test
INFO:arduino-mega2560.tests/pthread_cleanup:Run test.flash
INFO:arduino-mega2560.tests/pthread_cleanup:Success
INFO:arduino-mega2560.tests/pthread_condition_variable:Board supported: True
INFO:arduino-mega2560.tests/pthread_condition_variable:Board has enough memory: True
INFO:arduino-mega2560.tests/pthread_condition_variable:Application has test: True
INFO:arduino-mega2560.tests/pthread_condition_variable:Run compilation
INFO:arduino-mega2560.tests/pthread_condition_variable:Run test
INFO:arduino-mega2560.tests/pthread_condition_variable:Run test.flash
INFO:arduino-mega2560.tests/pthread_condition_variable:Success
INFO:arduino-mega2560.tests/pthread_cooperation:Board supported: True
INFO:arduino-mega2560.tests/pthread_cooperation:Board has enough memory: False
INFO:arduino-mega2560.tests/pthread_flood:Board supported: True
INFO:arduino-mega2560.tests/pthread_flood:Board has enough memory: True
INFO:arduino-mega2560.tests/pthread_flood:Application has test: True
INFO:arduino-mega2560.tests/pthread_flood:Run compilation
INFO:arduino-mega2560.tests/pthread_flood:Run test
INFO:arduino-mega2560.tests/pthread_flood:Run test.flash
INFO:arduino-mega2560.tests/pthread_flood:Success
INFO:arduino-mega2560.tests/pthread_rwlock:Board supported: True
INFO:arduino-mega2560.tests/pthread_rwlock:Board has enough memory: True
INFO:arduino-mega2560.tests/pthread_rwlock:Application has test: True
INFO:arduino-mega2560.tests/pthread_rwlock:Run compilation
INFO:arduino-mega2560.tests/pthread_rwlock:Run test
INFO:arduino-mega2560.tests/pthread_rwlock:Run test.flash
INFO:arduino-mega2560.tests/pthread_rwlock:Success
INFO:arduino-mega2560.tests/pthread_tls:Board supported: True
INFO:arduino-mega2560.tests/pthread_tls:Board has enough memory: True
INFO:arduino-mega2560.tests/pthread_tls:Application has test: True
INFO:arduino-mega2560.tests/pthread_tls:Run compilation
INFO:arduino-mega2560.tests/pthread_tls:Run test
INFO:arduino-mega2560.tests/pthread_tls:Run test.flash
INFO:arduino-mega2560.tests/pthread_tls:Success
INFO:arduino-mega2560:Tests successful
```


### Issues/PRs references

Found the compiler error while talking with @JulianHolzwarth while testing #12056 
You can view, comment on, or merge this pull request online at:

  https://github.com/RIOT-OS/RIOT/pull/12204

-- Commit Summary --

  * pthread_cond.h: use 'sys/types.h' value of 'clockid_t' for avr
  * tests/pthread*: enable pthread tests on avr
  * tests/pthread_condition_variable: adapt for slow boards

-- File Changes --

    M sys/posix/pthread/include/pthread_cond.h (10)
    M tests/pthread/Makefile (7)
    M tests/pthread_barrier/Makefile (12)
    M tests/pthread_cleanup/Makefile (7)
    M tests/pthread_condition_variable/Makefile (7)
    M tests/pthread_condition_variable/main.c (12)
    M tests/pthread_cooperation/Makefile (26)
    M tests/pthread_flood/Makefile (14)
    M tests/pthread_rwlock/Makefile (31)
    M tests/pthread_tls/Makefile (13)

-- Patch Links --

https://github.com/RIOT-OS/RIOT/pull/12204.patch
https://github.com/RIOT-OS/RIOT/pull/12204.diff

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/12204
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190911/d48839e7/attachment.htm>


More information about the notifications mailing list