mirror of
https://git.rtems.org/rtems-libbsd/
synced 2025-07-27 20:55:28 +08:00
rwlock01: Do not print in the worker task
The worker task must not block on the console device shared with the master task.
This commit is contained in:
parent
5084ad89e4
commit
1153f0c228
@ -88,8 +88,6 @@ worker_task(rtems_task_argument arg)
|
|||||||
test_context *ctx = (test_context *) arg;
|
test_context *ctx = (test_context *) arg;
|
||||||
struct rwlock *rw = &ctx->rw;
|
struct rwlock *rw = &ctx->rw;
|
||||||
|
|
||||||
puts("worker ready");
|
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
rtems_status_code sc;
|
rtems_status_code sc;
|
||||||
rtems_event_set events;
|
rtems_event_set events;
|
||||||
@ -103,43 +101,31 @@ worker_task(rtems_task_argument arg)
|
|||||||
assert(sc == RTEMS_SUCCESSFUL);
|
assert(sc == RTEMS_SUCCESSFUL);
|
||||||
|
|
||||||
if ((events & EVENT_RLOCK) != 0) {
|
if ((events & EVENT_RLOCK) != 0) {
|
||||||
puts("worker: rw_rlock");
|
|
||||||
|
|
||||||
rw_rlock(rw);
|
rw_rlock(rw);
|
||||||
ctx->done = true;
|
ctx->done = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((events & EVENT_WLOCK) != 0) {
|
if ((events & EVENT_WLOCK) != 0) {
|
||||||
puts("worker: rw_wlock");
|
|
||||||
|
|
||||||
rw_wlock(rw);
|
rw_wlock(rw);
|
||||||
ctx->done = true;
|
ctx->done = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((events & EVENT_TRY_RLOCK) != 0) {
|
if ((events & EVENT_TRY_RLOCK) != 0) {
|
||||||
puts("worker: rw_try_rlock");
|
|
||||||
|
|
||||||
ctx->rv = rw_try_rlock(rw);
|
ctx->rv = rw_try_rlock(rw);
|
||||||
ctx->done = true;
|
ctx->done = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((events & EVENT_TRY_WLOCK) != 0) {
|
if ((events & EVENT_TRY_WLOCK) != 0) {
|
||||||
puts("worker: rw_try_wlock");
|
|
||||||
|
|
||||||
ctx->rv = rw_try_wlock(rw);
|
ctx->rv = rw_try_wlock(rw);
|
||||||
ctx->done = true;
|
ctx->done = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((events & EVENT_UNLOCK) != 0) {
|
if ((events & EVENT_UNLOCK) != 0) {
|
||||||
puts("worker: rw_unlock");
|
|
||||||
|
|
||||||
rw_unlock(rw);
|
rw_unlock(rw);
|
||||||
ctx->done = true;
|
ctx->done = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((events & EVENT_SLEEP) != 0) {
|
if ((events & EVENT_SLEEP) != 0) {
|
||||||
puts("worker: rw_sleep");
|
|
||||||
|
|
||||||
ctx->rv = rw_sleep(ctx, rw, 0, "worker", ctx->timo);
|
ctx->rv = rw_sleep(ctx, rw, 0, "worker", ctx->timo);
|
||||||
ctx->done = true;
|
ctx->done = true;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user