- File:
-
- 1 edited
-
libcfa/src/concurrency/monitor.cfa (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/monitor.cfa
rf6f7b52 re25ef8c 9 9 // Author : Thierry Delisle 10 10 // Created On : Thd Feb 23 12:27:26 2017 11 // Last Modified By : Kyoung Seo12 // Last Modified On : Thd Jan 16 12:59:00 202513 // Update Count : 7 311 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Nov 27 12:13:14 2024 13 // Update Count : 72 14 14 // 15 15 … … 922 922 static inline [thread$ *, int] search_entry_queue( const __waitfor_mask_t & mask, monitor$ * monitors [], __lock_size_t count ) { 923 923 __queue_t(thread$) & entry_queue = monitors[0]->entry_queue; 924 925 #if 0 926 #if defined( __CFA_WITH_VERIFY__ ) 927 thread$ * last = 0p; 928 #endif 929 // For each thread in the entry-queue 930 for ( thread$ ** thrd_it = &entry_queue.head; (*thrd_it) != 1p; thrd_it = &get_next(**thrd_it) ) { 931 thread$ * curr = *thrd_it; 932 933 /* paranoid */ verifyf( !last || last->user_link.next == curr, "search not making progress, from %p (%p) to %p", 934 last, last->user_link.next, curr ); 935 /* paranoid */ verifyf( curr != last, "search not making progress, from %p to %p", last, curr ); 936 937 // For each acceptable check if it matches 938 int i = 0; 939 __acceptable_t * end = end(mask); 940 __acceptable_t * begin = begin(mask); 941 for ( __acceptable_t * it = begin; it != end; it++, i++ ) { 942 // Check for match 943 if ( *it == curr->monitors ) { 944 // If match, return it after removeing it from the entry queue 945 return [remove( entry_queue, thrd_it ), i]; 946 } 947 } 948 949 #if defined( __CFA_WITH_VERIFY__ ) 950 last = curr; 951 #endif 952 } 953 #else 924 954 // For each acceptable (respect lexical priority in waitfor statement) 925 int i = 0; 926 __acceptable_t * end = end(mask); 927 __acceptable_t * begin = begin(mask); 928 for ( __acceptable_t * it = begin; it != end; it++, i++ ) { 955 __acceptable_t * it = end(mask); it--; // end is passed the last node, so backup 956 for ( int i = mask.size - 1; i >= 0; i -= 1, it-- ) { 929 957 #if defined( __CFA_WITH_VERIFY__ ) 930 958 thread$ * last = 0p; … … 949 977 } // for 950 978 } // for 979 #endif 951 980 return [0, -1]; 952 981 }
Note:
See TracChangeset
for help on using the changeset viewer.