document the two locking options

parent ef97f174
......@@ -22,6 +22,7 @@ CFLAGS += "-DGIT_URL=\"$(GIT_URL)\""
LIBS = $(TARGET).a $(TARGET).so libertm_display.so
LIBOBJS = $(TARGET).o linux-uart-link.o common-uart-link.o udev-serial.o magics.o flock.o
LIBOBJS += semaph.o
all: libs main udev-find
libs: $(LIBS)
......@@ -45,6 +46,9 @@ ertm14-uart-link.o: $(ERTM_UART_LOCATION)/ertm14-uart-link.c
linux-uart-link.o: $(ERTM_BOARD_LOCATION)/common-uart-link.h
libertm.o: libertm.h private.h
semaph: semaph.o
semaph: LDLIBS+=-lpthread
libertm_display.so: display.o
$(LD) -shared -o $@ $^
......
......@@ -234,6 +234,11 @@ struct ertm_status *ertm_init(const char *address)
errno = ENODEV;
return NULL;
}
/* this hardcodes using file lock-based mutexes. This protects
* the critical section from concurrent processes but NOT from
* concurrent threads. In case of thread contention, use
* ertm_semaphore_mutex, implemented in semph.c based on POSIX
* semaphores */
st->mutex = ertm_flock_mutex;
if (st->mutex->create(st) < 0) {
errno = ENODEV;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment