Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions lwt/lwt.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,35 @@
/* lwt.h
* Pradeep, Yang
*/

#ifndef __LWT_H__
#define __LWT_H__

/* data structures */
struct lwt_tcb{ //thread control block;
void* ip;
void* sp;
void* bp;
int id;
int parent;
int childrenCount;
lwt_status_t tcb_status;
};

typedef void* (*lwt_fn_t) (void *);
typedef struct lwt_tcb* lwt_t; //a pointer to tcb, use it as pthread_t
typedef enum{
LWT_INFO_NTHD_RUNNABLE=0,
LWT_INFO_NTHD_BLOCKED,
LWT_INFO_NTHD_ZOMBIES
}lwt_info_t;

typedef enum{
RUN=1,
WAIT,
READY,
COMPLETE
}lwt_status_t;

/*
* lightweight thread APIs.
Expand Down