# Is it safe to use the fdb client library when my main application is also written by the flow language?

**URL:** <https://forums.foundationdb.org/t/is-it-safe-to-use-the-fdb-client-library-when-my-main-application-is-also-written-by-the-flow-language/4768>\
**Category:** Using FoundationDB\
**Created:** [January 21, 2025, 8:57am UTC](https://forums.foundationdb.org/t/is-it-safe-to-use-the-fdb-client-library-when-my-main-application-is-also-written-by-the-flow-language/4768 "2025-01-21T08:57:50Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ben131](https://sea1.discourse-cdn.com/foundationdb/user_avatar/forums.foundationdb.org/ben131/32/1847_2.png) [@ben131](https://forums.foundationdb.org/u/ben131)\
**Post date:** [January 21, 2025, 8:57am UTC](https://forums.foundationdb.org/t/is-it-safe-to-use-the-fdb-client-library-when-my-main-application-is-also-written-by-the-flow-language/4768/1 "2025-01-21T08:57:50Z")

</div>

In my application, the main thread sets up the `g_network` instance and runs an event loop by `g_network->run()`, and there is also another thread running the fdb client’s event loop.

It seems that `g_network` is a global variable defined in `flow/flow.cpp`, and the fdb client library also requires `setupNetwork` first. Does it mean that there will be two threads concurrently modifying and accessing the same `g_network` variable? I just tried this, and it works, but I don’t understand why.

---

<div class="post-metadata">

**Author:** ![ben131](https://sea1.discourse-cdn.com/foundationdb/user_avatar/forums.foundationdb.org/ben131/32/1847_2.png) [@ben131](https://forums.foundationdb.org/u/ben131)\
**Post date:** [January 26, 2025, 1:36am UTC](https://forums.foundationdb.org/t/is-it-safe-to-use-the-fdb-client-library-when-my-main-application-is-also-written-by-the-flow-language/4768/2 "2025-01-26T01:36:17Z")

</div>

After some research, I found the reason. In short, the main is linked to a shared library – libfdb\_c.so , and it has its own `g_network`.
