Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#96 closed enhancement (fixed)

roar_vs_iterate() should return -1 on a nonblocking iterate if it fails to write.

Reported by: themaister Owned by: themaister
Priority: medium Milestone: RoarAudio major release 0.4
Component: VS API Version: 0.4beta2
Keywords: Cc:
Architecture: Compiler:
Difficulty: Kernel:
Operating System: Parent Tickets: #76
Patch attached: no Protocol:
Sound driver: Topic: New feature

Description

Basically what the title says. If roar_vs_iterate() fails to write anything when not blocking, it should return -1 with error set accordingly.

Subtickets

Change History (4)

comment:1 Changed 9 years ago by ph3-der-loewe

  • Component changed from libroar and friends to VS API
  • Owner set to themaister

if the write itself fails (returns -1) the -1 is passed to caller. If no data are in buffer 0 is returned. Your problem is no data was written but no error, right?

comment:2 Changed 9 years ago by themaister

Yes. If I do while(roar_vs_iterate(vss, ROAR_VS_NOWAIT, NULL) > 0); on a nonblocking socket, I expect it to return -1 when the write() syscall (or the equivalent) finally received a EAGAIN errno. As of now it seems to return 1 instead.

I use this in mplayer to flush out the buffer as much as possible (nonblocking) before returning from get_avail();

Last edited 9 years ago by themaister (previous) (diff)

comment:3 Changed 9 years ago by ph3-der-loewe

  • Resolution set to fixed
  • Status changed from new to closed
  • Topic set to New feature
  • Version changed from current to 0.4beta2

roar_vs_iterate() now returns 1 for no work done but not EOF or error and >1 for work done and no EOF or error.

So just use:

while(roar_vs_iterate(vss, ROAR_VS_NOWAIT, &err) > 1);

comment:4 Changed 9 years ago by ph3-der-loewe

To additional notes from me about this:

  • It's a nonblocking VIO. If it's a socket or not is irrelevant. It may for example be a pipe, too.
  • write never fails here as it is never called. select() is used to ensure non-blocking or do the blocking itself. the call to *_write() is unlikely to ever block or return EAGAIN as it is not called if no data can be written. So it will likely never fail.
Note: See TracTickets for help on using tickets.