test
This commit is contained in:
@@ -198,6 +198,8 @@ void komodo_init()
|
|||||||
if ( didinit == 0 )
|
if ( didinit == 0 )
|
||||||
{
|
{
|
||||||
didinit = 1;
|
didinit = 1;
|
||||||
|
iguana_initQ(&DepositsQ,"Deposits");
|
||||||
|
iguana_initQ(&PendingsQ,"Pendings");
|
||||||
pthread_mutex_init(&komodo_mutex,NULL);
|
pthread_mutex_init(&komodo_mutex,NULL);
|
||||||
decode_hex(NOTARY_PUBKEY33,33,(char *)NOTARY_PUBKEY.c_str());
|
decode_hex(NOTARY_PUBKEY33,33,(char *)NOTARY_PUBKEY.c_str());
|
||||||
n = (int32_t)(sizeof(Notaries)/sizeof(*Notaries));
|
n = (int32_t)(sizeof(Notaries)/sizeof(*Notaries));
|
||||||
|
|||||||
@@ -16,6 +16,13 @@
|
|||||||
#define SATOSHIDEN ((uint64_t)100000000L)
|
#define SATOSHIDEN ((uint64_t)100000000L)
|
||||||
#define dstr(x) ((double)(x) / SATOSHIDEN)
|
#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; };
|
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;
|
typedef union _bits256 bits256;
|
||||||
|
|
||||||
@@ -1216,3 +1223,13 @@ int32_t queue_size(queue_t *queue)
|
|||||||
portable_mutex_unlock(&queue->mutex);
|
portable_mutex_unlock(&queue->mutex);
|
||||||
return count;
|
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);
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user