GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
ck_pflock(3) FreeBSD Library Functions Manual ck_pflock(3)

ck_pflock_init, ck_pflock_write_lock, ck_pflock_write_unlock, ck_pflock_read_lock, ck_pflock_read_unlock, —
centralized phase-fair reader-writer locks

Concurrency Kit (libck, -lck)

#include <ck_pflock.h>

ck_pflock_t lock = CK_PFLOCK_INITIALIZER;


void
ck_pflock_init(ck_pflock_t *lock);

void
ck_pflock_write_lock(ck_pflock_t *lock);

void
ck_pflock_write_unlock(ck_pflock_t *lock);

void
ck_pflock_read_lock(ck_pflock_t *lock);

void
ck_pflock_read_unlock(ck_pflock_t *lock);

This is a centralized phase-fair reader-writer lock. It requires little space overhead and has a low latency fast path.

#include <ck_pflock.h>

static ck_pflock_t lock = CK_TFLOCK_INITIALIZER;

static void
reader(void)
{

	for (;;) {
		ck_pflock_read_lock(&lock);
		/* Read-side critical section. */
		ck_pflock_read_unlock(&lock);
	}

	return;
}

static void
writer(void)
{

	for (;;) {
		ck_pflock_write_lock(&lock);
		/* Write-side critical section. */
		ck_pflock_write_unlock(&lock);
	}

	return;
}

ck_brlock(3), ck_rwlock(3), ck_tflock(3), ck_swlock(3)

Additional information available at http://concurrencykit.org/

April 22, 2014.

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.