}
#ifndef __KERNEL__
+#if 0
static jmp_buf eq_jumpbuf;
static void eq_timeout(int signal)
return rc;
}
+#else
+#include <errno.h>
-#endif
+/* FIXME
+ * Here timeout need a trick with tcpnal, definitely unclean but OK for
+ * this moment.
+ */
+
+/* global variables defined by tcpnal */
+extern int __tcpnal_eqwait_timeout_value;
+extern int __tcpnal_eqwait_timedout;
+
+int PtlEQWait_timeout(ptl_handle_eq_t eventq_in, ptl_event_t * event_out,
+ int timeout)
+{
+ int rc;
+
+ if (!timeout)
+ return PtlEQWait(eventq_in, event_out);
+
+ __tcpnal_eqwait_timeout_value = timeout;
+
+ while ((rc = PtlEQGet(eventq_in, event_out)) == PTL_EQ_EMPTY) {
+ nal_t *nal = ptl_hndl2nal(&eventq_in);
+
+ if (nal->yield)
+ nal->yield(nal);
+ if (__tcpnal_eqwait_timedout) {
+ if (__tcpnal_eqwait_timedout != ETIMEDOUT)
+ printf("Warning: yield return error %d\n",
+ __tcpnal_eqwait_timedout);
+ rc = PTL_EQ_EMPTY;
+ break;
+ }
+ }
+
+ __tcpnal_eqwait_timeout_value = 0;
+
+ return rc;
+}
+#endif
+#endif /* __KERNEL__ */
}
+/* FIXME cfs temporary workaround! FIXME
+ * global time out value
+ */
+int __tcpnal_eqwait_timeout_value = 0;
+int __tcpnal_eqwait_timedout = 0;
+
/* Function: yield
* Arguments: pid:
*
procbridge p=(procbridge)b->local;
pthread_mutex_lock(&p->mutex);
- pthread_cond_wait(&p->cond,&p->mutex);
+ if (!__tcpnal_eqwait_timeout_value) {
+ pthread_cond_wait(&p->cond,&p->mutex);
+ } else {
+ struct timeval now;
+ struct timespec timeout;
+
+ gettimeofday(&now, NULL);
+ timeout.tv_sec = now.tv_sec + __tcpnal_eqwait_timeout_value;
+ timeout.tv_nsec = now.tv_usec * 1000;
+
+ __tcpnal_eqwait_timedout =
+ pthread_cond_timedwait(&p->cond, &p->mutex, &timeout);
+ }
pthread_mutex_unlock(&p->mutex);
}
}
+/* FIXME cfs temporary workaround! FIXME
+ * global time out value
+ */
+int __tcpnal_eqwait_timeout_value = 0;
+int __tcpnal_eqwait_timedout = 0;
+
/* Function: yield
* Arguments: pid:
*
procbridge p=(procbridge)b->local;
pthread_mutex_lock(&p->mutex);
- pthread_cond_wait(&p->cond,&p->mutex);
+ if (!__tcpnal_eqwait_timeout_value) {
+ pthread_cond_wait(&p->cond,&p->mutex);
+ } else {
+ struct timeval now;
+ struct timespec timeout;
+
+ gettimeofday(&now, NULL);
+ timeout.tv_sec = now.tv_sec + __tcpnal_eqwait_timeout_value;
+ timeout.tv_nsec = now.tv_usec * 1000;
+
+ __tcpnal_eqwait_timedout =
+ pthread_cond_timedwait(&p->cond, &p->mutex, &timeout);
+ }
pthread_mutex_unlock(&p->mutex);
}
}
#ifndef __KERNEL__
+#if 0
static jmp_buf eq_jumpbuf;
static void eq_timeout(int signal)
return rc;
}
+#else
+#include <errno.h>
-#endif
+/* FIXME
+ * Here timeout need a trick with tcpnal, definitely unclean but OK for
+ * this moment.
+ */
+
+/* global variables defined by tcpnal */
+extern int __tcpnal_eqwait_timeout_value;
+extern int __tcpnal_eqwait_timedout;
+
+int PtlEQWait_timeout(ptl_handle_eq_t eventq_in, ptl_event_t * event_out,
+ int timeout)
+{
+ int rc;
+
+ if (!timeout)
+ return PtlEQWait(eventq_in, event_out);
+
+ __tcpnal_eqwait_timeout_value = timeout;
+
+ while ((rc = PtlEQGet(eventq_in, event_out)) == PTL_EQ_EMPTY) {
+ nal_t *nal = ptl_hndl2nal(&eventq_in);
+
+ if (nal->yield)
+ nal->yield(nal);
+ if (__tcpnal_eqwait_timedout) {
+ if (__tcpnal_eqwait_timedout != ETIMEDOUT)
+ printf("Warning: yield return error %d\n",
+ __tcpnal_eqwait_timedout);
+ rc = PTL_EQ_EMPTY;
+ break;
+ }
+ }
+
+ __tcpnal_eqwait_timeout_value = 0;
+
+ return rc;
+}
+#endif
+#endif /* __KERNEL__ */
}
+/* FIXME cfs temporary workaround! FIXME
+ * global time out value
+ */
+int __tcpnal_eqwait_timeout_value = 0;
+int __tcpnal_eqwait_timedout = 0;
+
/* Function: yield
* Arguments: pid:
*
procbridge p=(procbridge)b->local;
pthread_mutex_lock(&p->mutex);
- pthread_cond_wait(&p->cond,&p->mutex);
+ if (!__tcpnal_eqwait_timeout_value) {
+ pthread_cond_wait(&p->cond,&p->mutex);
+ } else {
+ struct timeval now;
+ struct timespec timeout;
+
+ gettimeofday(&now, NULL);
+ timeout.tv_sec = now.tv_sec + __tcpnal_eqwait_timeout_value;
+ timeout.tv_nsec = now.tv_usec * 1000;
+
+ __tcpnal_eqwait_timedout =
+ pthread_cond_timedwait(&p->cond, &p->mutex, &timeout);
+ }
pthread_mutex_unlock(&p->mutex);
}