- Timestamp:
- Nov 21, 2024, 8:35:12 AM (4 weeks ago)
- Branches:
- master
- Children:
- de7b7a5
- Parents:
- d945be9
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/monitor.cfa
rd945be9 r1cd2839 10 10 // Created On : Thd Feb 23 12:27:26 2017 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sun Feb 19 17:00:59 202313 // Update Count : 1 212 // Last Modified On : Thu Nov 21 08:31:55 2024 13 // Update Count : 18 14 14 // 15 15 … … 931 931 932 932 static inline [thread$ *, int] search_entry_queue( const __waitfor_mask_t & mask, monitor$ * monitors [], __lock_size_t count ) { 933 934 933 __queue_t(thread$) & entry_queue = monitors[0]->entry_queue; 935 934 935 #if 0 936 936 #if defined( __CFA_WITH_VERIFY__ ) 937 937 thread$ * last = 0p; 938 938 #endif 939 939 // For each thread in the entry-queue 940 for( thread$ ** thrd_it = &entry_queue.head; 941 (*thrd_it) != 1p; 942 thrd_it = &get_next(**thrd_it) 943 ) { 940 for ( thread$ ** thrd_it = &entry_queue.head; (*thrd_it) != 1p; thrd_it = &get_next(**thrd_it) ) { 944 941 thread$ * curr = *thrd_it; 945 942 946 /* paranoid */ verifyf( !last || last->user_link.next == curr, "search not making progress, from %p (%p) to %p", last, last->user_link.next, curr ); 943 /* paranoid */ verifyf( !last || last->user_link.next == curr, "search not making progress, from %p (%p) to %p", 944 last, last->user_link.next, curr ); 947 945 /* paranoid */ verifyf( curr != last, "search not making progress, from %p to %p", last, curr ); 948 946 … … 951 949 __acceptable_t * end = end (mask); 952 950 __acceptable_t * begin = begin(mask); 953 for( __acceptable_t * it = begin; it != end; it++, i++ ) { 954 // Check if we have a match 955 if( *it == curr->monitors ) { 956 957 // If we have a match return it 958 // after removeing it from the entry queue 951 for ( __acceptable_t * it = begin; it != end; it++, i++ ) { 952 // Check for match 953 if ( *it == curr->monitors ) { 954 // If match, return it after removeing it from the entry queue 959 955 return [remove( entry_queue, thrd_it ), i]; 960 956 } … … 965 961 #endif 966 962 } 967 963 #endif 964 int i = 0; 965 __acceptable_t * end = end (mask); 966 __acceptable_t * begin = begin(mask); 967 // For each acceptable (respect lexical priority in waitfor statement) 968 for ( __acceptable_t * it = begin; it != end; it++, i++ ) { 969 #if defined( __CFA_WITH_VERIFY__ ) 970 thread$ * last = 0p; 971 #endif // __CFA_WITH_VERIFY__ 972 973 for ( thread$ ** thrd_it = &entry_queue.head; (*thrd_it) != 1p; thrd_it = &get_next(**thrd_it) ) { 974 thread$ * curr = *thrd_it; 975 976 /* paranoid */ verifyf( !last || last->user_link.next == curr, "search not making progress, from %p (%p) to %p", 977 last, last->user_link.next, curr ); 978 /* paranoid */ verifyf( curr != last, "search not making progress, from %p to %p", last, curr ); 979 980 // For each thread in the entry-queue check for a match 981 if ( *it == curr->monitors ) { 982 // If match, return it after removeing from the entry queue 983 return [remove( entry_queue, thrd_it ), i]; 984 } // if 985 986 #if defined( __CFA_WITH_VERIFY__ ) 987 last = curr; 988 #endif 989 } // for 990 } // for 968 991 return [0, -1]; 969 992 }
Note: See TracChangeset
for help on using the changeset viewer.