grt_bool_t hashtable_insert(grt_word_t val) { unsigned i; hash_t hash = compute_hash(val); WRITE_LOCK; node_t **head = &table[hash.proc][hash.offset]; node_t *p = (node_t*) grt_read(hash.proc, (grt_word_t*) head); node_t *q = find_node(hash.proc, val, p); if (q) { UNLOCK; return GRT_TRUE; } q = (node_t*) grt_alloc(hash.proc, sizeof(node_t)); #if NB gasnet_put_nbi(hash.proc, (grt_word_t*) &q->next, &p, sizeof(grt_word_t)); gasnet_put_nbi(hash.proc, &q->val, &val, sizeof(grt_word_t)); gasnet_put_nbi(hash.proc, (grt_word_t*) head, (grt_word_t*) &q, sizeof(grt_word_t)); gasnet_wait_syncnbi_puts(); #else grt_write(hash.proc, (grt_word_t) p, (grt_word_t*) &q->next); grt_write(hash.proc, val, &q->val); grt_write(hash.proc, (grt_word_t) q, (grt_word_t*) head); #endif UNLOCK; return GRT_FALSE; }
void do_nonbulkputgets(void) { if (do_puts && do_nonbulk && do_explicit) { QUEUE_TEST("gasnet_put_nb", handles[i] = gasnet_put_nb(peerproc, tgtmem, msgbuf, payload), gasnet_wait_syncnb_all(handles, depth), (void)0, 0); } if (do_gets && do_nonbulk && do_explicit) { QUEUE_TEST("gasnet_get_nb", handles[i] = gasnet_get_nb(msgbuf, peerproc, tgtmem, payload), gasnet_wait_syncnb_all(handles, depth), (void)0, 0); } if (do_puts && do_nonbulk && do_implicit) { QUEUE_TEST("gasnet_put_nbi", gasnet_put_nbi(peerproc, tgtmem, msgbuf, payload), gasnet_wait_syncnbi_all(), (void)0, 0); } if (do_gets && do_nonbulk && do_implicit) { QUEUE_TEST("gasnet_get_nbi", gasnet_get_nbi(msgbuf, peerproc, tgtmem, payload), gasnet_wait_syncnbi_all(), (void)0, 0); } }