ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/Coro/Coro/State.xs
(Generate patch)

Comparing Coro/Coro/State.xs (file contents):
Revision 1.68 by root, Mon Dec 12 20:28:30 2005 UTC vs.
Revision 1.70 by root, Mon Dec 26 19:26:52 2005 UTC

27# ifndef IS_PADCONST 27# ifndef IS_PADCONST
28# define IS_PADCONST(v) 0 28# define IS_PADCONST(v) 0
29# endif 29# endif
30#endif 30#endif
31 31
32#include <errno.h>
32#include <signal.h> 33#include <signal.h>
33 34
34#ifdef HAVE_MMAP 35#ifdef HAVE_MMAP
35# include <unistd.h> 36# include <unistd.h>
36# include <sys/mman.h> 37# include <sys/mman.h>
57 58
58#include "CoroAPI.h" 59#include "CoroAPI.h"
59 60
60#ifdef USE_ITHREADS 61#ifdef USE_ITHREADS
61static perl_mutex coro_mutex; 62static perl_mutex coro_mutex;
62# define LOCK do { MUTEX_LOCK (&coro_mutex); } while (0) 63# define LOCK do { MUTEX_LOCK (&coro_mutex); } while (0)
63# define UNLOCK do { MUTEX_UNLOCK (&coro_mutex); } while (0) 64# define UNLOCK do { MUTEX_UNLOCK (&coro_mutex); } while (0)
64#else 65#else
65# define LOCK 0 66# define LOCK (void)0
66# define UNLOCK 0 67# define UNLOCK (void)0
67#endif 68#endif
68 69
69static struct CoroAPI coroapi; 70static struct CoroAPI coroapi;
70static AV *main_mainstack; /* used to differentiate between $main and others */ 71static AV *main_mainstack; /* used to differentiate between $main and others */
71static HV *coro_state_stash; 72static HV *coro_state_stash;
1146cede(...) 1147cede(...)
1147 PROTOTYPE: 1148 PROTOTYPE:
1148 CODE: 1149 CODE:
1149 api_cede (); 1150 api_cede ();
1150 1151
1152# and these are hacks
1153SV *
1154_aio_get_state ()
1155 CODE:
1156{
1157 struct {
1158 int errorno;
1159 int laststype;
1160 int laststatval;
1161 Stat_t statcache;
1162 } data;
1163
1164 data.errorno = errno;
1165 data.laststype = PL_laststype;
1166 data.laststatval = PL_laststatval;
1167 data.statcache = PL_statcache;
1168
1169 RETVAL = newSVpvn ((char *)&data, sizeof data);
1170}
1171 OUTPUT:
1172 RETVAL
1173
1174void
1175_aio_set_state (char *data_)
1176 PROTOTYPE: $
1177 CODE:
1178{
1179 struct {
1180 int errorno;
1181 int laststype;
1182 int laststatval;
1183 Stat_t statcache;
1184 } *data = (void *)data_;
1185
1186 errno = data->errorno;
1187 PL_laststype = data->laststype;
1188 PL_laststatval = data->laststatval;
1189 PL_statcache = data->statcache;
1190}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines