tracedefault.cpp revision 5c47137ffdbcb823e83b3cfc93bf8ccd3318bec3
8df974db6a280f05491e26c4f0f59e7568fe5b02James Phillpotts/*******************************************************************************
8df974db6a280f05491e26c4f0f59e7568fe5b02James Phillpotts* Header Files *
8df974db6a280f05491e26c4f0f59e7568fe5b02James Phillpotts*******************************************************************************/
8df974db6a280f05491e26c4f0f59e7568fe5b02James Phillpotts/*******************************************************************************
8df974db6a280f05491e26c4f0f59e7568fe5b02James Phillpotts* Global Variables *
8df974db6a280f05491e26c4f0f59e7568fe5b02James Phillpotts*******************************************************************************/
8df974db6a280f05491e26c4f0f59e7568fe5b02James Phillpotts/** The default trace buffer handle. */
8df974db6a280f05491e26c4f0f59e7568fe5b02James Phillpottsstatic RTTRACEBUF g_hDefaultTraceBuf = NIL_RTTRACEBUF;
8df974db6a280f05491e26c4f0f59e7568fe5b02James PhillpottsRTDECL(int) RTTraceSetDefaultBuf(RTTRACEBUF hTraceBuf)
8df974db6a280f05491e26c4f0f59e7568fe5b02James Phillpotts /* Retain the new buffer. */
8df974db6a280f05491e26c4f0f59e7568fe5b02James Phillpotts uint32_t cRefs = RTTraceBufRetain(hTraceBuf);
8df974db6a280f05491e26c4f0f59e7568fe5b02James Phillpotts hOldTraceBuf = (RTTRACEBUF)ASMAtomicXchgPtr((void **)&g_hDefaultTraceBuf, hTraceBuf);
8df974db6a280f05491e26c4f0f59e7568fe5b02James Phillpotts ASMAtomicXchgHandle(&g_hDefaultTraceBuf, hTraceBuf, &hOldTraceBuf);
8df974db6a280f05491e26c4f0f59e7568fe5b02James Phillpotts /* Race prevention kludge. */