Changeset 183788f1 in mainline for uspace/libc
- Timestamp:
- 2007-04-09T16:17:25Z (18 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 36f19c0
- Parents:
- de33dab
- Location:
- uspace/libc/generic/io
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/libc/generic/io/printf_core.c
rde33dab r183788f1 41 41 #include <ctype.h> 42 42 #include <string.h> 43 #include <async.h> /* for pseudo thread serialization */44 43 45 44 #define __PRINTF_FLAG_PREFIX 0x00000001 /**< show prefixes 0x or 0*/ … … 444 443 int width, precision; 445 444 uint64_t flags; 446 447 /* Don't let other pseudo threads interfere. */448 async_serialize_start();449 445 450 446 counter = 0; … … 679 675 } 680 676 681 async_serialize_end();682 677 return counter; 683 678 minus_out: 684 async_serialize_end();685 679 return -counter; 686 680 } -
uspace/libc/generic/io/vprintf.c
rde33dab r183788f1 37 37 #include <unistd.h> 38 38 #include <io/printf_core.h> 39 #include <futex.h> 40 #include <async.h> 41 42 static atomic_t printf_futex = FUTEX_INITIALIZER; 39 43 40 44 static int vprintf_write(const char *str, size_t count, void *unused) … … 50 54 int vprintf(const char *fmt, va_list ap) 51 55 { 52 struct printf_spec ps = {(int(*)(void *, size_t, void *)) vprintf_write, NULL}; 53 56 struct printf_spec ps = { 57 (int (*)(void *, size_t, void *)) vprintf_write, 58 NULL 59 }; 60 /* 61 * Prevent other threads to execute printf_core() 62 */ 63 futex_down(&printf_futex); 64 /* 65 * Prevent other pseudo threads of the same thread 66 * to execute printf_core() 67 */ 68 async_serialize_start(); 54 69 int ret = printf_core(fmt, &ps, ap); 55 70 async_serialize_end(); 71 futex_up(&printf_futex); 56 72 return ret; 57 73 }
Note:
See TracChangeset
for help on using the changeset viewer.