src/lib/fidl/c/walker_tests/llcpp_transaction_tests.cc
// It is not allowed to be accessed from multiple threads simultaneously
It is not allowed to be accessed from multiple threads simultaneously
It is not allowed to be accessed from multiple threads simultaneously
TEST(LlcppTransaction, concurrent_access_asserts) {
  sync_completion_t signal, wait;
  Transaction txn{&signal, &wait};
  Completer completer(&txn);
  std::thread t([&] { completer.Reply(1); });
  sync_completion_wait(&wait, ZX_TIME_INFINITE);
  ASSERT_DEATH([&] { completer.Reply(1); }, "concurrent access should crash");
  ASSERT_DEATH([&] { completer.Close(ZX_OK); }, "concurrent access should crash");
  ASSERT_DEATH([&] { completer.EnableNextDispatch(); }, "concurrent access should crash");
  ASSERT_DEATH([&] { completer.ToAsync(); }, "concurrent access should crash");
  sync_completion_signal(&signal);
  t.join();  
}
TEST ( LlcppTransaction , concurrent_access_asserts ) { sync_completion_t signal , wait ; Transaction txn { & signal , & wait } ; Completer completer ( & txn ) ; std :: thread t ( [ & ] { completer . Reply ( 1 ) ; } ) ; sync_completion_wait ( & wait , ZX_TIME_INFINITE ) ; ASSERT_DEATH ( [ & ] { completer . Reply ( 1 ) ; } , " " ) ; ASSERT_DEATH ( [ & ] { completer . Close ( ZX_OK ) ; } , " " ) ; ASSERT_DEATH ( [ & ] { completer . EnableNextDispatch ( ) ; } , " " ) ; ASSERT_DEATH ( [ & ] { completer . ToAsync ( ) ; } , " " ) ; sync_completion_signal ( & signal ) ; t . join ( ) ; }
It is not allowed to be accessed from multiple threads simultaneously
It is not allowed to be accessed from multiple threads simultaneously
// TODO(fxbug.dev/54499): Hide assertion failed messages from output - they are confusing. // Don't accidentally invoke ~Completer() while `t` is still in Reply().