Index: head/devel/st/Makefile =================================================================== --- head/devel/st/Makefile (revision 127212) +++ head/devel/st/Makefile (revision 127213) @@ -1,46 +1,47 @@ # New ports collection makefile for: st # Date created: Sun Feb 18 2001 # Whom: tobez@tobez.org # # $FreeBSD$ # PORTNAME= st PORTVERSION= 1.4 +PORTREVISION= 1 CATEGORIES= devel MASTER_SITES= ${MASTER_SITE_SOURCEFORGE} MASTER_SITE_SUBDIR= state-threads -MAINTAINER= tobez@FreeBSD.org +MAINTAINER= alfred@FreeBSD.org COMMENT= State Threads Library for Internet Applications INSTALLS_SHLIB= yes ONLY_FOR_ARCHS= i386 alpha .include post-patch: @${RM} -f ${WRKSRC}/Makefile ${WRKSRC}/examples/Makefile @${CP} ${FILESDIR}/Makefile.main ${WRKSRC}/Makefile @${CP} ${FILESDIR}/Makefile.examples ${WRKSRC}/examples/Makefile post-install: @${MKDIR} ${PREFIX}/include @${INSTALL_DATA} ${WRKSRC}/public.h ${PREFIX}/include/st.h @${MKDIR} ${PREFIX}/share/examples/st @${INSTALL_DATA} ${WRKSRC}/examples/Makefile ${PREFIX}/share/examples/st @${INSTALL_DATA} ${WRKSRC}/examples/README ${PREFIX}/share/examples/st @${INSTALL_DATA} ${WRKSRC}/examples/error.c ${PREFIX}/share/examples/st @${INSTALL_DATA} ${WRKSRC}/examples/lookupdns.c ${PREFIX}/share/examples/st @${INSTALL_DATA} ${WRKSRC}/examples/proxy.c ${PREFIX}/share/examples/st @${INSTALL_DATA} ${WRKSRC}/examples/res.c ${PREFIX}/share/examples/st @${INSTALL_DATA} ${WRKSRC}/examples/server.c ${PREFIX}/share/examples/st .if !defined(NOPORTDOCS) @${MKDIR} ${PREFIX}/share/doc/st @${INSTALL_DATA} ${WRKSRC}/docs/fig.gif ${PREFIX}/share/doc/st @${INSTALL_DATA} ${WRKSRC}/docs/notes.html ${PREFIX}/share/doc/st @${INSTALL_DATA} ${WRKSRC}/docs/reference.html ${PREFIX}/share/doc/st @${INSTALL_DATA} ${WRKSRC}/docs/st.html ${PREFIX}/share/doc/st .endif .include Property changes on: head/devel/st/Makefile ___________________________________________________________________ Modified: cvs2svn:cvs-rev ## -1 +1 ## -1.7 \ No newline at end of property +1.8 \ No newline at end of property Index: head/devel/st/files/patch-aa =================================================================== --- head/devel/st/files/patch-aa (nonexistent) +++ head/devel/st/files/patch-aa (revision 127213) @@ -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 + + /* Property changes on: head/devel/st/files/patch-aa ___________________________________________________________________ Added: cvs2svn:cvs-rev ## -0,0 +1 ## +1.1 \ No newline at end of property Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Index: head/devel/st/files/patch-ab =================================================================== --- head/devel/st/files/patch-ab (nonexistent) +++ head/devel/st/files/patch-ab (revision 127213) @@ -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 @@ +
st_mutex_t
+
st_utime_t
+
st_netfd_t
++
st_switch_cb_t
+

+

Error Handling
+

+@@ -20,6 +21,8 @@ +

+

st_init()
+
st_getfdlimit()
++
st_set_switch_in_cb()
++
st_set_switch_out_cb()
+

+

Thread Control and Identification
+

+@@ -244,6 +247,29 @@ +


+

+ ++ ++

st_switch_cb_t

++ ++Context switch callback function type. ++

++

Syntax
++ ++
++#include <st.h>
++
++typedef void (*st_switch_cb_t)(void);
++
++

++

Description
++ ++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. ++ ++

++


++

++ + +

Error Handling

+ +@@ -267,6 +293,8 @@ +
+
st_init()
+
st_getfdlimit()
++
st_set_switch_in_cb()
++
st_set_switch_out_cb()
+
+

+


+@@ -343,6 +371,41 @@ +
Description
+ This function returns the limit on the number of open file descriptors which + is set by the st_init() function. ++

++


++

++ ++ ++

st_set_switch_in_cb()

++ ++ ++

st_set_switch_out_cb()

++
++Set the callback function for thread switches. ++

++

Syntax
++ ++
++#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);
++
++

++

Parameters
++st_set_switch_in_cb() and st_set_switch_out_cb() have the ++following parameter:

++cb

++A function to be called when a thread is resumed and stopped respectively.

++

Returns
++The previous callback function pointer. ++

++

Description
++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.

++These functions can be called at any time. +

+


+

Property changes on: head/devel/st/files/patch-ab ___________________________________________________________________ Added: cvs2svn:cvs-rev ## -0,0 +1 ## +1.1 \ No newline at end of property Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Index: head/devel/st/files/patch-ac =================================================================== --- head/devel/st/files/patch-ac (nonexistent) +++ head/devel/st/files/patch-ac (revision 127213) @@ -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); Property changes on: head/devel/st/files/patch-ac ___________________________________________________________________ Added: cvs2svn:cvs-rev ## -0,0 +1 ## +1.1 \ No newline at end of property Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Index: head/devel/st/files/patch-ad =================================================================== --- head/devel/st/files/patch-ad (nonexistent) +++ head/devel/st/files/patch-ad (revision 127213) @@ -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 Property changes on: head/devel/st/files/patch-ad ___________________________________________________________________ Added: cvs2svn:cvs-rev ## -0,0 +1 ## +1.1 \ No newline at end of property Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property