Skip to content

Commit 565e606

Browse files
committed
Replace usage of sleep() with SLEEP()
Replace all uses of sleep() with SLEEP() macro for cross-platform sleeping.
1 parent 8eb86b5 commit 565e606

File tree

20 files changed

+49
-33
lines changed

20 files changed

+49
-33
lines changed

ether/edsu.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@
7878
#include "../tools/error.h"
7979
#include "../tools/files.h"
8080
#include "../tools/flags.h"
81+
#include "../tools/timer.h"
8182
#include "../ether/ether.h"
8283
#include "../ether/channel.h"
8384

@@ -144,7 +145,7 @@ signed function (struct channel * channel, unsigned pause, signed fd)
144145
{
145146
error (1, errno, CHANNEL_CANTSEND);
146147
}
147-
sleep (pause);
148+
SLEEP (pause);
148149
}
149150
return (0);
150151
}

ether/efsu.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@
7777
#include "../tools/memory.h"
7878
#include "../tools/number.h"
7979
#include "../tools/symbol.h"
80+
#include "../tools/timer.h"
8081
#include "../tools/flags.h"
8182
#include "../ether/channel.h"
8283

@@ -209,7 +210,7 @@ static void iterate (int argc, char const * argv [], struct channel * channel, u
209210
argv++;
210211
if ((argc) && (* argv))
211212
{
212-
sleep (pause);
213+
SLEEP (pause);
213214
}
214215
}
215216
return;
@@ -335,7 +336,7 @@ int main (int argc, char const * argv [])
335336
iterate (argc, argv, &channel, pause);
336337
if (loop)
337338
{
338-
sleep (delay);
339+
SLEEP (delay);
339340
}
340341
}
341342
closechannel (&channel);

plc/Antiphon.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464

6565
#include "../tools/error.h"
6666
#include "../tools/flags.h"
67+
#include "../tools/timer.h"
6768
#include "../plc/plc.h"
6869

6970
signed Antiphon (struct plc * plc, byte source [], byte target [])
@@ -128,7 +129,7 @@ signed Antiphon (struct plc * plc, byte source [], byte target [])
128129

129130
#endif
130131

131-
sleep (plc->timer);
132+
SLEEP (plc->timer);
132133
return (0);
133134
}
134135

plc/FlashDevice2.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
#ifndef FLASHDEVICE2_SOURCE
5757
#define FLASHDEVICE2_SOURCE
5858

59+
#include "../tools/timer.h"
5960
#include "../plc/plc.h"
6061

6162
signed FlashDevice2 (struct plc * plc, uint32_t options)
@@ -80,7 +81,7 @@ signed FlashDevice2 (struct plc * plc, uint32_t options)
8081
{
8182
return (-1);
8283
}
83-
sleep (5);
84+
SLEEP (5);
8485
if (WaitForStart (plc, firmware, sizeof (firmware)) == 0)
8586
{
8687
if (strcmp (firmware, "BootLoader"))
@@ -100,7 +101,7 @@ signed FlashDevice2 (struct plc * plc, uint32_t options)
100101
{
101102
return (-1);
102103
}
103-
sleep (5);
104+
SLEEP (5);
104105
if (WaitForStart (plc, firmware, sizeof (firmware)))
105106
{
106107
return (-1);

plc/amprate.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@
7272
#include "../tools/flags.h"
7373
#include "../tools/files.h"
7474
#include "../tools/error.h"
75+
#include "../tools/timer.h"
7576
#include "../plc/plc.h"
7677

7778
/*====================================================================*
@@ -185,7 +186,7 @@ void manager (struct plc * plc, signed count, signed pause)
185186
{
186187
ResetDevice (plc);
187188
}
188-
sleep (pause);
189+
SLEEP (pause);
189190
}
190191
return;
191192
}

plc/ampstat.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@
7272
#include "../tools/flags.h"
7373
#include "../tools/files.h"
7474
#include "../tools/error.h"
75+
#include "../tools/timer.h"
7576
#include "../plc/plc.h"
7677

7778
/*====================================================================*
@@ -220,7 +221,7 @@ void manager (struct plc * plc, signed count, signed pause)
220221
{
221222
LinkStatistics (plc);
222223
}
223-
sleep (pause);
224+
SLEEP (pause);
224225
}
225226
return;
226227
}

plc/amptool.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@
7373
#include "../tools/flags.h"
7474
#include "../tools/files.h"
7575
#include "../tools/error.h"
76+
#include "../tools/timer.h"
7677
#include "../ether/channel.h"
7778
#include "../key/HPAVKey.h"
7879
#include "../key/keys.h"
@@ -312,7 +313,7 @@ static void manager (struct plc * plc, signed count, signed pause)
312313
{
313314
ResetDevice (plc);
314315
}
315-
sleep (pause);
316+
SLEEP (pause);
316317
}
317318
return;
318319
}

plc/ampwait.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -593,7 +593,7 @@ static void function (struct plc * plc, char const * firmware)
593593
if (plc->sleep)
594594
{
595595
Request (plc, "Pause %d seconds", plc->sleep);
596-
sleep (plc->sleep);
596+
SLEEP (plc->sleep);
597597
}
598598
return;
599599
}

plc/coqos_man.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
#include "../tools/flags.h"
7575
#include "../tools/files.h"
7676
#include "../tools/error.h"
77+
#include "../tools/timer.h"
7778
#include "../plc/plc.h"
7879
#include "../plc/coqos.h"
7980

@@ -221,7 +222,7 @@ signed con_man (struct plc * plc, uint16_t TOT_BW_USED)
221222
Confirm (plc, "Set up bandwidth monitoring.");
222223
break;
223224
}
224-
sleep (1);
225+
SLEEP (1);
225226
}
226227
while (1)
227228
{
@@ -280,7 +281,7 @@ signed con_man (struct plc * plc, uint16_t TOT_BW_USED)
280281
continue;
281282
}
282283
printf ("Connection ID: %04X suspended\n", lowcid);
283-
sleep (5);
284+
SLEEP (5);
284285

285286
/* flush out old data */
286287

plc/int6k.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@
7373
#include "../tools/flags.h"
7474
#include "../tools/files.h"
7575
#include "../tools/error.h"
76+
#include "../tools/timer.h"
7677
#include "../plc/plc.h"
7778
#include "../ether/channel.h"
7879
#include "../key/HPAVKey.h"
@@ -312,7 +313,7 @@ static void manager (struct plc * plc, signed count, signed pause)
312313
{
313314
ResetDevice (plc);
314315
}
315-
sleep (pause);
316+
SLEEP (pause);
316317
}
317318
return;
318319
}

0 commit comments

Comments
 (0)