handmade.network » Forums » Learning DB Performance/Behavior
Mārtiņš Možeiko
1477 posts
1 project
#12187 Learning DB Performance/Behavior
3 months, 2 weeks ago Edited by Mārtiņš Možeiko on June 10, 2017, 7:47 p.m.

I wanted to get the pointer to the database as data but I don't know how to do it.
How can I get the Data pointer back to main thread.

It's all in the videos :)

a) use global variable
b) use Queue argument for InitilizeSqlite function.
c) use Data argument for InitilizeSqlite function.

Casey uses c) point in HH. Look at Win32DoNextWorkQueueEntry function where he passes Entry.Data to Entry.Callback function pointer. For example, one of these function pointers will be doing asset loading from thread in LoadAssetWork function. It will use passed Data argument to figure out where what asset to load and where to store result that later can be used in main thread.