This commit is contained in:
jl777
2016-10-27 09:57:40 -03:00
parent eebc32ea25
commit a18fbdc541
2 changed files with 19 additions and 0 deletions

View File

@@ -198,6 +198,8 @@ void komodo_init()
if ( didinit == 0 )
{
didinit = 1;
iguana_initQ(&DepositsQ,"Deposits");
iguana_initQ(&PendingsQ,"Pendings");
pthread_mutex_init(&komodo_mutex,NULL);
decode_hex(NOTARY_PUBKEY33,33,(char *)NOTARY_PUBKEY.c_str());
n = (int32_t)(sizeof(Notaries)/sizeof(*Notaries));

View File

@@ -16,6 +16,13 @@
#define SATOSHIDEN ((uint64_t)100000000L)
#define dstr(x) ((double)(x) / SATOSHIDEN)
typedef struct queue
{
struct queueitem *list;
portable_mutex_t mutex;
char name[64],initflag;
} queue_t;
union _bits256 { uint8_t bytes[32]; uint16_t ushorts[16]; uint32_t uints[8]; uint64_t ulongs[4]; uint64_t txid; };
typedef union _bits256 bits256;
@@ -1216,3 +1223,13 @@ int32_t queue_size(queue_t *queue)
portable_mutex_unlock(&queue->mutex);
return count;
}
void iguana_initQ(queue_t *Q,char *name)
{
char *tst,*str = "need to init each Q when single threaded";
memset(Q,0,sizeof(*Q));
strcpy(Q->name,name);
queue_enqueue(name,Q,queueitem(str),1);
if ( (tst= queue_dequeue(Q,1)) != 0 )
free_queueitem(tst);
}