sammielove45 / propgcc

Automatically exported from code.google.com/p/propgcc
1 stars 1 forks source link

fgetc should yield for pthreads #35

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Function fgetc always blocks until a character is available without
yielding. This is inconvenient at best and broken at worst.

Is there any way we can make it yield for pthread programs without
using too much code space ?

Original issue reported on code.google.com by jsden...@gmail.com on 5 Mar 2012 at 8:20

GoogleCodeExporter commented 9 years ago
The full duplex driver now yields correctly. This is the default serial driver 
for pthreads programs, so it should fix the most common usage of fgetc. Other 
low level drivers (like the disk driver) will have to be modified to yield in 
their wait loops too.

This was a good exercise, it revealed a bug in pthread_yield() (it was not 
yielding correctly to sleeping processes) which I've also checked in a fix for.

Original comment by ersm...@hfx.eastlink.ca on 13 Mar 2012 at 1:02