-
Notifications
You must be signed in to change notification settings - Fork 224
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP: start working on a way to send EXEC_SQL to the DB thread
This has a deadlock bug that needs to be ironed out. Signed-off-by: Cole Miller <[email protected]>
- Loading branch information
1 parent
779c991
commit f638fd7
Showing
3 changed files
with
70 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,39 @@ | ||
#ifndef DQLITE_REVAMP_H_ | ||
#define DQLITE_REVAMP_H_ | ||
|
||
#include "lib/queue.h" | ||
#include "registry.h" | ||
#include "tuple.h" | ||
|
||
#include <semaphore.h> | ||
#include <pthread.h> | ||
#include <stdbool.h> | ||
|
||
struct db_context | ||
{ | ||
sem_t sem; | ||
pthread_mutex_t mutex; | ||
pthread_cond_t cond; | ||
struct registry registry; | ||
queue exec_sql_reqs; | ||
bool shutdown; | ||
}; | ||
|
||
struct exec_sql_req | ||
{ | ||
char *db_name; | ||
char *sql; | ||
struct value *params; | ||
queue queue; | ||
}; | ||
|
||
int dbContextInit(struct db_context *ctx, struct config *config); | ||
|
||
int postExecSqlReq(struct db_context *ctx, | ||
struct exec_sql_req req, | ||
void *data, | ||
void (*cb)(struct exec_sql_req, int, void *)); | ||
|
||
void dbContextClose(struct db_context *ctx); | ||
|
||
void *dbTask(void *arg); | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters