Changeset 22018 for trunk/src/ntdll/rtl.c
- Timestamp:
- Sep 20, 2012, 4:34:09 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/ntdll/rtl.c
r21916 r22018 31 31 #include "winreg.h" 32 32 #include "heapstring.h" 33 #include "win/winnt.h" 34 #include "win/wine/exception.h" 33 35 34 36 #include <misc.h> … … 698 700 return ~crc; 699 701 } 702 703 /************************************************************************* 704 * RtlInitializeSListHead [NTDLL.@] 705 */ 706 VOID WINAPI RtlInitializeSListHead(PSLIST_HEADER list) 707 { 708 list->Alignment = 0; 709 } 710 711 /************************************************************************* 712 * RtlQueryDepthSList [NTDLL.@] 713 */ 714 WORD WINAPI RtlQueryDepthSList(PSLIST_HEADER list) 715 { 716 return list->Depth; 717 } 718 719 /************************************************************************* 720 * RtlFirstEntrySList [NTDLL.@] 721 */ 722 PSLIST_ENTRY WINAPI RtlFirstEntrySList(const SLIST_HEADER* list) 723 { 724 return list->Next.Next; 725 } 726 727 /************************************************************************* 728 * RtlInterlockedFlushSList [NTDLL.@] 729 */ 730 PSLIST_ENTRY WINAPI RtlInterlockedFlushSList(PSLIST_HEADER list) 731 { 732 SLIST_HEADER old, new; 733 734 if (!list->Depth) return NULL; 735 new.Alignment = 0; 736 do 737 { 738 old = *list; 739 new.Sequence = old.Sequence + 1; 740 } while (interlocked_cmpxchg64((__int64 *)&list->Alignment, new.Alignment, 741 old.Alignment) != old.Alignment); 742 return old.Next.Next; 743 } 744 745 /************************************************************************* 746 * RtlInterlockedPushEntrySList [NTDLL.@] 747 */ 748 PSLIST_ENTRY WINAPI RtlInterlockedPushEntrySList(PSLIST_HEADER list, PSLIST_ENTRY entry) 749 { 750 SLIST_HEADER old, new; 751 752 new.Next.Next = entry; 753 do 754 { 755 old = *list; 756 entry->Next = old.Next.Next; 757 new.Depth = old.Depth + 1; 758 new.Sequence = old.Sequence + 1; 759 } while (interlocked_cmpxchg64((__int64 *)&list->Alignment, new.Alignment, 760 old.Alignment) != old.Alignment); 761 return old.Next.Next; 762 } 763 764 /************************************************************************* 765 * RtlInterlockedPopEntrySList [NTDLL.@] 766 */ 767 PSLIST_ENTRY WINAPI RtlInterlockedPopEntrySList(PSLIST_HEADER list) 768 { 769 SLIST_HEADER old, new; 770 PSLIST_ENTRY entry; 771 772 do 773 { 774 old = *list; 775 if (!(entry = old.Next.Next)) return NULL; 776 /* entry could be deleted by another thread */ 777 __TRY 778 { 779 new.Next.Next = entry->Next; 780 new.Depth = old.Depth - 1; 781 new.Sequence = old.Sequence + 1; 782 } 783 __EXCEPT_PAGE_FAULT 784 { 785 } 786 __ENDTRY 787 } while (interlocked_cmpxchg64((__int64 *)&list->Alignment, new.Alignment, 788 old.Alignment) != old.Alignment); 789 return entry; 790 } 791 792 /************************************************************************* 793 * RtlInterlockedPushListSList [NTDLL.@] 794 */ 795 PSLIST_ENTRY WINAPI RtlInterlockedPushListSList(PSLIST_HEADER list, PSLIST_ENTRY first, 796 PSLIST_ENTRY last, ULONG count) 797 { 798 SLIST_HEADER old, new; 799 800 new.Next.Next = first; 801 do 802 { 803 old = *list; 804 new.Depth = old.Depth + count; 805 new.Sequence = old.Sequence + 1; 806 last->Next = old.Next.Next; 807 } while (interlocked_cmpxchg64((__int64 *)&list->Alignment, new.Alignment, 808 old.Alignment) != old.Alignment); 809 return old.Next.Next; 810 }
Note:
See TracChangeset
for help on using the changeset viewer.