implement lua_thread_abort, add lua_thread_yield_state func, and fix lua_thread_resume_state to use protected mode
#include "chain.h"
#include <stdlib.h>
#include <assert.h>
void *_chain_add (struct _chain_head *head, bool tail, size_t size)
{
struct _chain_item *item;
// sanity-check
assert(size >= sizeof(item));
// allocate the chain item
if ((item = calloc(1, size)) == NULL)
return NULL;
// insert
if (tail)
TAILQ_INSERT_TAIL(head, item, _chain_list);
else
TAILQ_INSERT_HEAD(head, item, _chain_list);
// ok
return item;
}