Changeset 3849:dbd0c483126a in roaraudio
- Timestamp:
- 05/16/10 22:32:00 (14 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libroaross/libroaross.c
r3792 r3849 233 233 }; 234 234 235 236 static int _update_nonblock (struct handle * handle); 237 235 238 static void _init_os (void) { 236 239 memset(&_os, 0, sizeof(_os)); … … 656 659 657 660 _mix_settings.sid.pcm = roar_stream_get_id(&(handle->stream)); 661 662 _update_nonblock(handle); 663 664 return 0; 665 } 666 667 // ------------------------------------- 668 // function to update O_NONBLOCK: 669 // ------------------------------------- 670 671 static int _update_nonblock (struct handle * handle) { 672 int opened = 0; 673 int state = handle->sysio_flags & O_NONBLOCK ? ROAR_SOCKET_NONBLOCK : ROAR_SOCKET_BLOCK; 674 675 switch (handle->type) { 676 case HT_NONE: 677 case HT_STATIC: 678 case HT_MIXER: 679 // we can ignore setting of nonblock flag here. 680 return 0; 681 break; 682 case HT_VIO: 683 opened = 1; 684 break; 685 case HT_STREAM: 686 case HT_WAVEFORM: 687 case HT_MIDI: 688 case HT_DMX: 689 opened = handle->stream_opened; 690 break; 691 } 692 693 if ( opened ) { 694 return roar_vio_nonblock(&(handle->stream_vio), state); 695 } 658 696 659 697 return 0; … … 1646 1684 diff = (int)argl ^ pointer->handle->sysio_flags; 1647 1685 diff &= (int)~(int)(O_DIRECT|O_APPEND|O_LARGEFILE|O_NOATIME|O_NOCTTY|O_TRUNC); 1686 1687 if ( diff & O_NONBLOCK ) { 1688 diff -= O_NONBLOCK; 1689 pointer->handle->sysio_flags ^= O_NONBLOCK; 1690 if ( _update_nonblock(pointer->handle) == -1 ) { 1691 pointer->handle->sysio_flags ^= O_NONBLOCK; 1692 return -1; 1693 } 1694 } 1695 1648 1696 if ( diff == 0 ) { // only flags changed we ignore anyway. 1649 pointer->handle->sysio_flags = (int)argl;1697 pointer->handle->sysio_flags = (int)argl; 1650 1698 ret = 0; 1651 1699 } else {
Note: See TracChangeset
for help on using the changeset viewer.