Changeset 3400:e2e4250da752 in roaraudio
- Timestamp:
- 02/11/10 15:55:09 (14 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libroarpulse/operation.c
r3398 r3400 39 39 #include <libroarpulse/libroarpulse.h> 40 40 41 /** An asynchronous operation object */ 42 struct pa_operation { 43 size_t refc; 44 pa_operation_state_t state; 45 }; 46 47 pa_operation *roar_pa_operation_new(pa_operation_state_t initstate) { 48 pa_operation * o = roar_mm_malloc(sizeof(pa_operation)); 49 50 if ( o == NULL ) 51 return NULL; 52 53 memset(o, 0, sizeof(pa_operation)); 54 55 o->refc = 1; 56 57 o->state = initstate; 58 59 return o; 60 } 61 62 static void _operation_free(pa_operation *o) { 63 roar_mm_free(o); 64 } 65 66 /** Increase the reference count by one */ 67 pa_operation *pa_operation_ref(pa_operation *o) { 68 if ( o == NULL ) 69 return NULL; 70 71 o->refc++; 72 73 return o; 74 } 75 76 /** Decrease the reference count by one */ 77 void pa_operation_unref(pa_operation *o) { 78 if ( o == NULL ) 79 return; 80 81 o->refc--; 82 83 if ( o->refc < 1 ) 84 _operation_free(o); 85 } 86 87 /** Cancel the operation. Beware! This will not necessarily cancel the execution of the operation on the server side. */ 88 void pa_operation_cancel(pa_operation *o) { 89 // we ignore this 90 } 91 92 /** Return the current status of the operation */ 93 pa_operation_state_t pa_operation_get_state(pa_operation *o) { 94 if ( o == NULL ) 95 return -1; 96 97 return o->state; 98 } 99 41 100 //ll
Note: See TracChangeset
for help on using the changeset viewer.