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

msmshazan:
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.