zephyr/kernel/nanokernel/wait_q.c
tulasinagraj ce2574a30b nanokernel: remove duplicate symbols in image file
Jira ZEP-68,zephyr.elf shows duplicate routines which increases the foot print.
Current fix removes duplicate routines and reduces foot print of the image

Change-Id: I01a2e5a8a02481ab33a2bb09e9c545d6879c1b81
Signed-off-by: tulasinagraj <tulasi.r@tcs.com>
2016-07-18 18:47:03 +00:00

52 lines
1.3 KiB
C

/* wait queue for multiple fibers on nanokernel objects */
/*
* Copyright (c) 2015 Wind River Systems, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <wait_q.h>
/*
* Remove first fiber from a wait queue and put it on the ready queue, knowing
* that the wait queue is not empty.
*/
static struct tcs *_nano_wait_q_remove_no_check(struct _nano_queue *wait_q)
{
struct tcs *tcs = wait_q->head;
if (wait_q->tail == wait_q->head) {
_nano_wait_q_reset(wait_q);
} else {
wait_q->head = tcs->link;
}
tcs->link = 0;
_nano_fiber_ready(tcs);
return tcs;
}
/*
* Remove first fiber from a wait queue and put it on the ready queue.
* Abort and return NULL if the wait queue is empty.
*/
struct tcs *_nano_wait_q_remove(struct _nano_queue *wait_q)
{
return wait_q->head ? _nano_wait_q_remove_no_check(wait_q) : NULL;
}