49 kmp_int32 __kmpc_cancel(
ident_t* loc_ref, kmp_int32 gtid, kmp_int32 cncl_kind) {
50 kmp_info_t *this_thr = __kmp_threads [ gtid ];
52 KC_TRACE( 10, (
"__kmpc_cancel: T#%d request %d OMP_CANCELLATION=%d\n", gtid, cncl_kind, __kmp_omp_cancellation) );
54 KMP_DEBUG_ASSERT(cncl_kind != cancel_noreq);
55 KMP_DEBUG_ASSERT(cncl_kind == cancel_parallel || cncl_kind == cancel_loop ||
56 cncl_kind == cancel_sections || cncl_kind == cancel_taskgroup);
57 KMP_DEBUG_ASSERT(__kmp_get_gtid() == gtid);
59 if (__kmp_omp_cancellation) {
67 kmp_team_t *this_team = this_thr->th.th_team;
68 KMP_DEBUG_ASSERT(this_team);
69 kmp_int32 old = KMP_COMPARE_AND_STORE_RET32(&(this_team->t.t_cancel_request), cancel_noreq, cncl_kind);
70 if (old == cancel_noreq || old == cncl_kind) {
79 case cancel_taskgroup:
84 kmp_taskgroup_t* taskgroup;
86 task = this_thr->th.th_current_task;
87 KMP_DEBUG_ASSERT( task );
89 taskgroup = task->td_taskgroup;
91 kmp_int32 old = KMP_COMPARE_AND_STORE_RET32(&(taskgroup->cancel_request), cancel_noreq, cncl_kind);
92 if (old == cancel_noreq || old == cncl_kind) {
112 KMP_DEBUG_ASSERT(!__kmp_omp_cancellation);
127 kmp_int32 __kmpc_cancellationpoint(
ident_t* loc_ref, kmp_int32 gtid, kmp_int32 cncl_kind) {
128 kmp_info_t *this_thr = __kmp_threads [ gtid ];
130 KC_TRACE( 10, (
"__kmpc_cancellationpoint: T#%d request %d OMP_CANCELLATION=%d\n", gtid, cncl_kind, __kmp_omp_cancellation) );
132 KMP_DEBUG_ASSERT(cncl_kind != cancel_noreq);
133 KMP_DEBUG_ASSERT(cncl_kind == cancel_parallel || cncl_kind == cancel_loop ||
134 cncl_kind == cancel_sections || cncl_kind == cancel_taskgroup);
135 KMP_DEBUG_ASSERT(__kmp_get_gtid() == gtid);
137 if (__kmp_omp_cancellation) {
139 case cancel_parallel:
141 case cancel_sections:
145 kmp_team_t *this_team = this_thr->th.th_team;
146 KMP_DEBUG_ASSERT(this_team);
147 if (this_team->t.t_cancel_request) {
148 if (cncl_kind == this_team->t.t_cancel_request) {
162 case cancel_taskgroup:
166 kmp_taskdata_t* task;
167 kmp_taskgroup_t* taskgroup;
169 task = this_thr->th.th_current_task;
170 KMP_DEBUG_ASSERT( task );
172 taskgroup = task->td_taskgroup;
176 return !!taskgroup->cancel_request;
191 KMP_DEBUG_ASSERT(!__kmp_omp_cancellation);
208 __kmpc_cancel_barrier(
ident_t *loc, kmp_int32 gtid) {
210 kmp_info_t *this_thr = __kmp_threads [ gtid ];
211 kmp_team_t *this_team = this_thr->th.th_team;
213 KMP_DEBUG_ASSERT(__kmp_get_gtid() == gtid);
219 if (__kmp_omp_cancellation) {
222 switch (this_team->t.t_cancel_request) {
223 case cancel_parallel:
228 this_team->t.t_cancel_request = cancel_noreq;
233 case cancel_sections:
238 this_team->t.t_cancel_request = cancel_noreq;
244 case cancel_taskgroup:
275 int __kmp_get_cancellation_status(
int cancel_kind) {
276 if (__kmp_omp_cancellation) {
277 kmp_info_t *this_thr = __kmp_entry_thread();
279 switch (cancel_kind) {
280 case cancel_parallel:
282 case cancel_sections:
284 kmp_team_t *this_team = this_thr->th.th_team;
285 return this_team->t.t_cancel_request == cancel_kind;
287 case cancel_taskgroup:
289 kmp_taskdata_t* task;
290 kmp_taskgroup_t* taskgroup;
291 task = this_thr->th.th_current_task;
292 taskgroup = task->td_taskgroup;
293 return taskgroup && taskgroup->cancel_request;
KMP_EXPORT void __kmpc_barrier(ident_t *, kmp_int32 global_tid)