File tree Expand file tree Collapse file tree 2 files changed +20
-1
lines changed
Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -327,7 +327,7 @@ function fix_cxx_flag {
327327 CXXCOMPILER=` grep " CXX = " kaldi.mk | awk ' {print $3}' `
328328 if [ $CXXCOMPILER == " g++" ]; then
329329 $CXXCOMPILER -dumpversion | \
330- awk ' {if(NR==1 && $$ 1<"4.8 ") print "sed \"s/-Wno-unused-local-typedefs/-Wall /g\" \
330+ awk ' {if(NR==1 && $1<"4.4 ") print "sed \"s/-Wno-unused-local-typedefs//g\" \
331331 kaldi.mk > tmpf; mv tmpf kaldi.mk; "}' | sh -
332332 fi
333333}
Original file line number Diff line number Diff line change 2121
2222#include " base/kaldi-common.h"
2323#include " thread/kaldi-thread.h"
24+ #include " thread/kaldi-mutex.h"
2425
2526namespace kaldi {
2627
@@ -80,11 +81,29 @@ void TestThreads() {
8081 }
8182}
8283
84+ void TestMutex () {
85+ for (int32 i = 0 ; i < 4 ; i++) {
86+ Mutex mut;
87+ for (int32 i = 0 ; i < 100 ; i++) {
88+ if (rand () % 2 == 0 ) {
89+ mut.Lock ();
90+ KALDI_ASSERT (!mut.TryLock ());
91+ mut.Unlock ();
92+ } else {
93+ KALDI_ASSERT (mut.TryLock ());
94+ mut.Unlock ();
95+ }
96+ }
97+ }
98+ }
99+
100+
83101
84102} // end namespace kaldi.
85103
86104int main () {
87105 using namespace kaldi ;
88106 TestThreads ();
107+ TestMutex ();
89108}
90109
You can’t perform that action at this time.
0 commit comments