1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-02-12 19:22:41 +00:00

Revert "Backport atomic job locking from ksh 93v- beta" (52067c3d)

That patch broke the build on Cygwin, where gcc apparently doesn't
have the required atomic addition/subtraction compiler builtins.
The build fails at link time with those functions not found.

As far as I know, ksh was actually working fine (after @JohnoKing's
gcc workaround in c258a04f), so I'll just revert this for now. If a
need for it is demonstrated later, we'll have to add a feature test
or find some other way to get it working on Cygwin.
This commit is contained in:
Martijn Dekker 2021-03-17 14:25:34 +00:00
parent 82c6922330
commit 595a0a5684
2 changed files with 15 additions and 7 deletions

View file

@ -33,7 +33,6 @@
# include <signal.h>
#endif /* !SIGINT */
#include "FEATURE/options"
#include <aso.h>
#undef JOBS
#if defined(SIGCLD) && !defined(SIGCHLD)
@ -126,13 +125,16 @@ extern struct jobs job;
#define vmbusy() 0
#endif
#define job_lock() asoincint(&job.in_critical)
#define job_lock() (job.in_critical++)
#define job_unlock() \
do { \
int _sig; \
if (asogetint(&job.in_critical) == 1 && (_sig = job.savesig) && !vmbusy()) \
job_reap(_sig); \
asodecint(&job.in_critical); \
int sig; \
if (!--job.in_critical && (sig = job.savesig)) \
{ \
if (!job.in_critical++ && !vmbusy()) \
job_reap(sig); \
job.in_critical--; \
} \
} while(0)
extern const char e_jobusage[];

View file

@ -1891,8 +1891,14 @@ again:
void *job_subsave(void)
{
struct back_save *bp = new_of(struct back_save,0);
/*
* We must make a lock first before doing anything else,
* otherwise GCC will remove the job locking mechanism
* as a result of compiler optimization.
*/
job_lock();
struct back_save *bp = new_of(struct back_save,0);
*bp = bck;
bp->prev = bck.prev;
bck.count = 0;