Skip to content

Commit

Permalink
Merge pull request #497 from Jafaral/coswitch-typo
Browse files Browse the repository at this point in the history
runtime: fix typo, drop unnecessary line and fix associated comment
  • Loading branch information
Don-Ward authored Jan 2, 2025
2 parents 816ab8f + d00406a commit 10dbbd3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 15 deletions.
16 changes: 5 additions & 11 deletions src/h/rmacros.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,8 @@
#define Ts_Main 01 /* This is the main co-expression */
#define Ts_Thread 02 /* This is a thread */
#define Ts_Attached 04 /* OS-level thread attached to this ce */

#define Ts_Async 010 /* asynchronous (concurrent) thread */
#define Ts_Actived 020 /* activated at least once */
#define Ts_Active 040 /* someone activated me */

#define Ts_WTinbox 0100 /* waiting on inbox Q */
#define Ts_WToutbox 0200 /* waiting on outbox Q */
#define Ts_Posix 0400 /* POSIX (pthread-based) coexpression */
#define Ts_Posix 020 /* POSIX (pthread-based) coexpression */

#define Ts_SoftThread 01000 /* soft thread */

Expand All @@ -122,11 +116,11 @@
#define CHECK_FLAG(X,F) ((X) & (F))
#define NOT_CHECK_FLAG(X,F) (!CHECK_FLAG(X,F))

#define IS_TS_MAIN(X) CHECK_FLAG(X, Ts_Main)
#define IS_TS_THREAD(X) CHECK_FLAG(X, Ts_Thread)
#define IS_TS_MAIN(X) CHECK_FLAG(X, Ts_Main)
#define IS_TS_THREAD(X) CHECK_FLAG(X, Ts_Thread)
#define IS_TS_ATTACHED(X) CHECK_FLAG(X, Ts_Attached)
#define IS_TS_POSIX(X) CHECK_FLAG(X, Ts_Posix)
#define IS_TS_ASYNC(X) CHECK_FLAG(X, Ts_Async)
#define IS_TS_POSIX(X) CHECK_FLAG(X, Ts_Posix)
#define IS_TS_ASYNC(X) CHECK_FLAG(X, Ts_Async)
#define IS_TS_SYNC(X) (!IS_TS_ASYNC(X))
#define IS_TS_SOFTTHREAD(X) CHECK_FLAG(X, Ts_SoftThread)

Expand Down
6 changes: 2 additions & 4 deletions src/runtime/rcoexpr.r
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ int co_chng(struct b_coexpr *ncp,
* Each co-expression has its own posix thread. So always switch
* to the new thread state when changing co-expressions.
*/
#ifdef NativeCoSwitch
#ifdef NativeCoswitch
if (ccp->program != ncp->program) {
curtstate = ncp->tstate;
global_curtstate = ncp->tstate;
Expand Down Expand Up @@ -444,15 +444,13 @@ int co_chng(struct b_coexpr *ncp,
/*
* Time to switch context to the new co-expression.
* the type of switch depends on whether the new co-expression
* has its own attached thread or not or if it is of type
* posix and being activated for the first time
* has its own attached thread or not.
*/
MUTEX_LOCKBLK(ncp, "lock co-expression");
#ifdef PthreadCoswitch
if (IS_TS_ATTACHED(ncp->status)) {
SET_FLAG(ncp->status, Ts_Attached);
MUTEX_UNLOCKBLK(ncp, "lock co-expression");
pthreadcoswitch(ccp, ncp, ccp->status, ncp->status );
}
Expand Down

0 comments on commit 10dbbd3

Please sign in to comment.