https://mooseframework.inl.gov
Functions | Variables
mutex_test.C File Reference

Go to the source code of this file.

Functions

void uexternaldb_ (int *LOP, int *, Real [], Real *, int *, int *)
 

Variables

Real mutex_test_global_thread_counter
 

Function Documentation

◆ uexternaldb_()

void uexternaldb_ ( int LOP,
int ,
Real  [],
Real ,
int ,
int  
)

Definition at line 23 of file mutex_test.C.

29 {
30  switch (*LOP)
31  {
32  // beginning of the simulation
33  case 0:
34  {
35  MutexInit(2);
36  MutexLock(2);
38  MutexUnlock(2);
39  break;
40  }
41 
42  // beginning of the timestep
43  case 1:
44  {
45  for (int i = 0; i < 1000; ++i)
46  {
47  MutexLock(2);
49  MutexUnlock(2);
50  }
51  break;
52  }
53 
54  // end of the simulation
55  case 3:
56  {
57  if (get_thread_id_() == 0)
58  Moose::out << "sum = " << mutex_test_global_thread_counter << ".\n";
59  break;
60  }
61  }
62 }
void MutexInit(int id)
Definition: AbaqusUtils.C:386
int get_thread_id_()
Definition: AbaqusUtils.C:58
Real mutex_test_global_thread_counter
Definition: mutex_test.C:20
void MutexUnlock(int id)
Definition: AbaqusUtils.C:398
void MutexLock(int id)
Definition: AbaqusUtils.C:392

Variable Documentation

◆ mutex_test_global_thread_counter

Real mutex_test_global_thread_counter

Definition at line 20 of file mutex_test.C.

Referenced by uexternaldb_().