diff options
author | Alfred Perlstein <alfred@FreeBSD.org> | 2005-01-24 19:53:31 +0000 |
---|---|---|
committer | Alfred Perlstein <alfred@FreeBSD.org> | 2005-01-24 19:53:31 +0000 |
commit | 5bf60bbe9b5443cd5b851fceea553f11c2d5b246 (patch) | |
tree | 3ff415f41bae29fda4539e8220d0491a29d4c18c /devel/st/files | |
parent | 6a1b2ca975d6c758e319e1201a4657e7c5be98b2 (diff) | |
download | ports-5bf60bbe9b5443cd5b851fceea553f11c2d5b246.tar.gz ports-5bf60bbe9b5443cd5b851fceea553f11c2d5b246.zip |
Notes
Diffstat (limited to 'devel/st/files')
-rw-r--r-- | devel/st/files/patch-aa | 49 | ||||
-rw-r--r-- | devel/st/files/patch-ab | 101 | ||||
-rw-r--r-- | devel/st/files/patch-ac | 16 | ||||
-rw-r--r-- | devel/st/files/patch-ad | 25 |
4 files changed, 191 insertions, 0 deletions
diff --git a/devel/st/files/patch-aa b/devel/st/files/patch-aa new file mode 100644 index 000000000000..61296d7e4ccf --- /dev/null +++ b/devel/st/files/patch-aa @@ -0,0 +1,49 @@ +diff -ur common.h common.h +--- common.h Fri Feb 22 12:55:46 2002 ++++ common.h Fri Jan 21 15:14:51 2005 +@@ -190,6 +190,7 @@ + int on_ioq; /* Is it on ioq? */ + } _st_pollq_t; + ++typedef void (*_st_switch_cb_t)(void); + + typedef struct _st_vp { + _st_thread_t *idle_thread; /* Idle thread for this vp */ +@@ -204,6 +205,8 @@ + #endif + st_utime_t sleep_max; + int pagesize; ++ _st_switch_cb_t switch_out_cb; /* called when a thread is switched out */ ++ _st_switch_cb_t switch_in_cb; /* called when a thread is switched in */ + + #ifndef USE_POLL + int maxfd; +@@ -362,12 +365,22 @@ + * Switch away from the current thread context by saving its state and + * calling the thread scheduler + */ +-#define _ST_SWITCH_CONTEXT(_thread) \ +- ST_BEGIN_MACRO \ +- if (!MD_SETJMP((_thread)->context)) { \ +- _st_vp_schedule(); \ +- } \ +- ST_DEBUG_ITERATE_THREADS(); \ ++#define _ST_SWITCH_CONTEXT(_thread) \ ++ ST_BEGIN_MACRO \ ++ if (_st_this_vp.switch_out_cb != NULL && \ ++ _thread != _st_this_vp.idle_thread && \ ++ _thread->state != _ST_ST_ZOMBIE) { \ ++ _st_this_vp.switch_out_cb(); \ ++ } \ ++ if (!MD_SETJMP((_thread)->context)) { \ ++ _st_vp_schedule(); \ ++ } \ ++ ST_DEBUG_ITERATE_THREADS(); \ ++ if (_st_this_vp.switch_in_cb != NULL && \ ++ _thread != _st_this_vp.idle_thread && \ ++ _thread->state != _ST_ST_ZOMBIE) { \ ++ _st_this_vp.switch_in_cb(); \ ++ } \ + ST_END_MACRO + + /* diff --git a/devel/st/files/patch-ab b/devel/st/files/patch-ab new file mode 100644 index 000000000000..346051cd407f --- /dev/null +++ b/devel/st/files/patch-ab @@ -0,0 +1,101 @@ +diff -ur docs/reference.html docs/reference.html +--- docs/reference.html Fri Oct 25 19:54:20 2002 ++++ docs/reference.html Fri Jan 21 15:14:24 2005 +@@ -13,6 +13,7 @@ + <DL><DD><A HREF=#mutex_t>st_mutex_t</A></DD></DL> + <DL><DD><A HREF=#utime_t>st_utime_t</A></DD></DL> + <DL><DD><A HREF=#netfd_t>st_netfd_t</A></DD></DL> ++<DL><DD><A HREF=#switch_cb_t>st_switch_cb_t</A></DD></DL> + <P> + <DD><A HREF=#errors><B>Error Handling</B></A></DD> + <P> +@@ -20,6 +21,8 @@ + <P> + <DL><DD><A HREF=#st_init>st_init()</A></DD></DL> + <DL><DD><A HREF=#st_getfdlimit>st_getfdlimit()</A></DD></DL> ++<DL><DD><A HREF=#st_set_switch_in_cb>st_set_switch_in_cb()</A></DD></DL> ++<DL><DD><A HREF=#st_set_switch_out_cb>st_set_switch_out_cb()</A></DD></DL> + <P> + <DD><A HREF=#threads><B>Thread Control and Identification</B></A></DD> + <P> +@@ -244,6 +247,29 @@ + <HR> + <P> + ++<A NAME="switch_cb_t"> ++<H4>st_switch_cb_t</H4> ++</A> ++Context switch callback function type. ++<P> ++<H5>Syntax</H5> ++ ++<PRE> ++#include <st.h> ++ ++typedef void (*st_switch_cb_t)(void); ++</PRE> ++<P> ++<H5>Description</H5> ++ ++This datatype is a convenience type for describing a pointer ++to a function that will be called when a thread is set to stop ++or set to run. ++ ++<P> ++<HR> ++<P> ++ + <A NAME="errors"> + <H2>Error Handling</H2> + </A> +@@ -267,6 +293,8 @@ + <DL> + <DD><A HREF=#st_init>st_init()</A></DD> + <DD><A HREF=#st_getfdlimit>st_getfdlimit()</A></DD> ++<DD><A HREF=#st_set_switch_in_cb>st_set_switch_in_cb()</A></DD> ++<DD><A HREF=#st_set_switch_out_cb>st_set_switch_out_cb()</A></DD> + </DL> + <P> + <HR> +@@ -343,6 +371,41 @@ + <H5>Description</H5> + This function returns the limit on the number of open file descriptors which + is set by the <A HREF=#st_init>st_init()</A> function. ++<P> ++<HR> ++<P> ++ ++<A NAME="st_set_switch_in_cb"> ++<H4>st_set_switch_in_cb()</H4> ++</A> ++<A NAME="st_set_switch_out_cb"> ++<H4>st_set_switch_out_cb()</H4> ++</A> ++Set the callback function for thread switches. ++<P> ++<H5>Syntax</H5> ++ ++<PRE> ++#include <st.h> ++ ++st_switch_cb_t st_set_switch_in_cb(st_switch_cb_t cb); ++st_switch_cb_t st_set_switch_out_cb(st_switch_cb_t cb); ++</PRE> ++<P> ++<H5>Parameters</H5> ++<TT>st_set_switch_in_cb()</TT> and <TT>st_set_switch_out_cb()</TT> have the ++following parameter:<P> ++<TT>cb</TT><P> ++A function to be called when a thread is resumed and stopped respectively.<P> ++<H5>Returns</H5> ++The previous callback function pointer. ++<P> ++<H5>Description</H5> ++These functions set the callback for when a thread is resumed and stopped ++respectively. After being called any thread switch will call the callback. ++It is suggested that thread specific data is used to differentiate between ++different threads.<P> ++These functions can be called at any time. + <P> + <HR> + <P> diff --git a/devel/st/files/patch-ac b/devel/st/files/patch-ac new file mode 100644 index 000000000000..e04789d67964 --- /dev/null +++ b/devel/st/files/patch-ac @@ -0,0 +1,16 @@ +diff -ur public.h public.h +--- public.h Thu Mar 28 21:09:08 2002 ++++ public.h Fri Jan 21 15:14:24 2005 +@@ -85,9 +85,12 @@ + typedef struct _st_cond * st_cond_t; + typedef struct _st_mutex * st_mutex_t; + typedef struct _st_netfd * st_netfd_t; ++typedef void (*st_switch_cb_t)(void); + + extern int st_init(void); + extern int st_getfdlimit(void); ++extern st_switch_cb_t st_set_switch_in_cb(st_switch_cb_t cb); ++extern st_switch_cb_t st_set_switch_out_cb(st_switch_cb_t cb); + + extern st_thread_t st_thread_self(void); + extern void st_thread_exit(void *retval); diff --git a/devel/st/files/patch-ad b/devel/st/files/patch-ad new file mode 100644 index 000000000000..401dfcd37c70 --- /dev/null +++ b/devel/st/files/patch-ad @@ -0,0 +1,25 @@ +diff -ur sched.c sched.c +--- sched.c Wed Jan 30 19:46:11 2002 ++++ sched.c Fri Jan 21 15:14:24 2005 +@@ -232,6 +232,21 @@ + return 0; + } + ++st_switch_cb_t st_set_switch_in_cb(st_switch_cb_t cb) ++{ ++ st_switch_cb_t ocb = _st_this_vp.switch_in_cb; ++ ++ _st_this_vp.switch_in_cb = cb; ++ return (ocb); ++} ++ ++st_switch_cb_t st_set_switch_out_cb(st_switch_cb_t cb) ++{ ++ st_switch_cb_t ocb = _st_this_vp.switch_out_cb; ++ ++ _st_this_vp.switch_out_cb = cb; ++ return (ocb); ++} + + /* + * Start function for the idle thread |