File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -54,6 +54,7 @@ typedef struct DtmTransStatus
5454typedef struct
5555{
5656 cid_t cid ;
57+ long time_shift ;
5758 volatile slock_t lock ;
5859 DtmTransStatus * trans_list_head ;
5960 DtmTransStatus * * trans_list_tail ;
@@ -105,7 +106,7 @@ static timestamp_t dtm_get_current_time()
105106{
106107 struct timeval tv ;
107108 gettimeofday (& tv , NULL );
108- return (timestamp_t )tv .tv_sec * USEC + tv .tv_usec ;
109+ return (timestamp_t )tv .tv_sec * USEC + tv .tv_usec + local -> time_shift ;
109110}
110111
111112static void dtm_sleep (timestamp_t interval )
@@ -136,6 +137,11 @@ static cid_t dtm_get_cid()
136137static cid_t dtm_sync (cid_t global_cid )
137138{
138139 cid_t local_cid ;
140+ #if 1
141+ while ((local_cid = dtm_get_cid ()) < global_cid ) {
142+ local -> time_shift += global_cid - local_cid ;
143+ }
144+ #else
139145 while ((local_cid = dtm_get_cid ()) < global_cid ) {
140146 SpinLockRelease (& local -> lock );
141147#if TRACE_SLEEP_TIME
@@ -160,6 +166,7 @@ static cid_t dtm_sync(cid_t global_cid)
160166#endif
161167 SpinLockAcquire (& local -> lock );
162168 }
169+ #endif
163170 return global_cid ;
164171}
165172
@@ -525,6 +532,7 @@ void DtmInitialize()
525532 local = (DtmNodeState * )ShmemInitStruct ("dtm" , sizeof (DtmNodeState ), & found );
526533 if (!found )
527534 {
535+ local -> time_shift = 0 ;
528536 local -> cid = dtm_get_current_time ();
529537 local -> trans_list_head = NULL ;
530538 local -> trans_list_tail = & local -> trans_list_head ;
You can’t perform that action at this time.
0 commit comments